All my efforts so far generate errors outside my code.
Here is sample (EntityEntry is a struct with Name and Id properties, Entries is a list of them):
foreach(string key in dictionary.Keys)
{
Entries.Add(new EntityEntry { Name = key, Id = dictionary[key] });
}
Grid grid = new Grid();
Label label = new Label
{
FontSize = 15D,
FontAttributes = FontAttributes.Bold,
};
label.SetBinding(Label.TextProperty, "Name");
grid.Children.Add(label);
ListViewTemplateCell lt = new ListViewTemplateCell() { View = grid};
DataTemplate dt = new DataTemplate(() => lt.View);
EntitiesLv = new RadListView
{
Background = Colors.PaleTurquoise,
HorizontalOptions = LayoutOptions.Fill,
IsItemsReorderEnabled = false,
ItemTemplate = dt,
ItemsSource = Entries,
LayoutDefinition = new ListViewGridLayout
{
HorizontalItemSpacing = 5D,
VerticalItemSpacing = 5D
},
LoadOnDemandBufferItemsCount = 5,
LoadOnDemandMode = LoadOnDemandMode.Automatic,
Margin = new Thickness(10, 10),
SelectionMode = SelectionMode.Single,
VerticalOptions = LayoutOptions.Fill,
VerticalScrollBarVisibility = ScrollBarVisibility.Default,
};
EntitiesLv.GestureRecognizers.Add(new TapGestureRecognizer { Command = ListTapped, NumberOfTapsRequired = 1 });
EntitiesLv.SelectionChanged += EntitiesLvOnSelectionChanged;
Error occurs if ItemTemplate and ItemsSource are both set, but not if just one is.
All help appreciated.