When using the __ItemStyle properties of RadListView, they are not being applied if the SelectionMode is set to None. It makes sense that the PressedItemStyle and SelectedItemStyle properties are not used, since they are not applicable if nothing can be selected. However, the ReorderItemStyle in particular should still be used.
Example:
public class ItemStyleNotAppliedExample : ContentPage
{
private readonly ListViewItemStyle WhiteBG = new ListViewItemStyle
{
BackgroundColor = Color.White
};
private readonly ListViewItemStyle YellowBG = new ListViewItemStyle
{
BackgroundColor = Color.Yellow
};
private readonly ListViewItemStyle RedBG = new ListViewItemStyle
{
BackgroundColor = Color.Red
};
private readonly ListViewItemStyle BlueBG = new ListViewItemStyle
{
BackgroundColor = Color.Blue
};
public ItemStyleNotAppliedExample()
{
BackgroundColor = Color.Gray;
var items = new ObservableCollection<Item>
{
new Item("Item 1"),
new Item("Item 2"),
new Item("Item 3"),
new Item("Item 4"),
new Item("Item 5"),
};
Content = new RadListView
{
SelectionMode = SelectionMode.None,
IsItemsReorderEnabled = true,
ItemsSource = items,
ItemTemplate = new DataTemplate(typeof(ItemView)),
ItemStyle = WhiteBG,
PressedItemStyle = YellowBG,
SelectedItemStyle = RedBG,
ReorderItemStyle = BlueBG,
};
}
private class Item
{
public string Name { get; }
public Item(string name)
{
Name = name;
}
}
private class ItemView : ListViewTemplateCell
{
public ItemView()
{
var checkbox = new CheckBox
{
VerticalOptions = LayoutOptions.Center
};
var label = new Label
{
VerticalOptions = LayoutOptions.Center
};
label.SetBinding(Label.TextProperty, nameof(Item.Name));
View = new StackLayout
{
BackgroundColor = Color.Transparent,
Orientation = StackOrientation.Horizontal,
Children =
{
checkbox,
label
}
};
}
}
}