public class DeficiencyTextGroup : ObservableCollection<DeficiencyText>
{
public DeficiencyText Caption { get; set; }
}
Now i have a ObservableCollection<DeficiencyTextGroup> TextGroups; and this is set to the ListView´s ItemsSource property.
This looks like:
<ListView ItemsSource="{Binding TextGroups}"
IsGroupingEnabled="true"
GroupDisplayBinding="{Binding Caption.Text}">
<!-- header / caption of texts -->
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Margin="0,5,0,0">
<Label Text="{Binding Caption.Text}" Margin="5,15,5,15" />
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<!-- deficiency text -->
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Text}" LineBreakMode="WordWrap" Margin="5,1,5,1" />
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Maybe this is also possible with the SfListView?
Thanks again
Greetings
Thomas
listView.DataSource.GroupDescriptors.Clear(); |
listView.DataSource.GroupDescriptors.Add(new GroupDescriptor()
{
PropertyName = "Caption.ContactName",
KeySelector = (object obj1) =>
{
var item = (obj1 as ContactsViewModel);
return item.Caption.ContactName[0].ToString();
},
}); |