|
<syncfusion:SfListView x:Name="listView" ItemSize="80"
AllowGroupExpandCollapse="True" SelectionMode="None"
GroupHeaderSize="40"
ItemsSource="{Binding EmployeeInfo}" ItemSpacing="2" >
<syncfusion:SfListView.DataSource>
<dataSource:DataSource>
<dataSource:DataSource.GroupDescriptors>
<dataSource:GroupDescriptor PropertyName="Designation" />
<dataSource:GroupDescriptor PropertyName="Level" />
</dataSource:DataSource.GroupDescriptors>
</dataSource:DataSource>
</syncfusion:SfListView.DataSource>
<syncfusion:SfListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout BackgroundColor="{Binding Level,Converter={StaticResource TemplateConverter}}" Padding="{Binding Level,Converter={StaticResource TemplateConverter}}">
<Label Text="{Binding Key}" FontSize="20" FontAttributes="Bold" Margin="3"
VerticalOptions="Center" HorizontalOptions="Start"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</syncfusion:SfListView.GroupHeaderTemplate>
</syncfusion:SfListView> |
|
public class GroupHeaderConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType.Name == "Color")
{
if ((int)value == 1)
return Color.FromHex("#db3232");
else
return Color.FromHex("#32dbd0");
}
else
{
if ((int)value == 1)
return new Thickness(5, 5, 5, 0);
else
return new Thickness((int)value * 15, 5, 5, 0);
}
}
} |