Hello,
I am using SfListView in my Xamarin.Form app, where items are grouped based on Folder name.
Unfortunately I am not able to change label color.
Please see attached xaml code.
<xForms:SfListView x:Name="ListView" ItemSize="100" ItemsSource="{Binding Devices}" AllowGroupExpandCollapse="True" SelectionMode="None" SelectionGesture="Hold" SelectionBackgroundColor="{StaticResource ColorTransparent}" HoldCommand="{Binding HoldCommand}">
<xForms:SfListView.ItemTemplate>
<DataTemplate x:DataType="model:DashboardDevice">
<Grid Padding="10">
<Frame CornerRadius="10"
BorderColor="{Binding Color}"
BackgroundColor="{Binding Color}"
Padding="0">
<Label Text="{Binding Name}" FontAttributes="Bold" TextColor="{StaticResource ColorText}" FontSize="19" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
</Frame>
</Grid>
</DataTemplate>
</xForms:SfListView.ItemTemplate>
<xForms:SfListView.LayoutManager>
<xForms:GridLayout SpanCount="3"/>
</xForms:SfListView.LayoutManager>
<xForms:SfListView.DataSource>
<dataSource:DataSource>
<dataSource:DataSource.SortDescriptors>
<dataSource:SortDescriptor PropertyName="Name" Direction="Ascending"/>
</dataSource:DataSource.SortDescriptors>
<dataSource:DataSource.GroupDescriptors>
<dataSource:GroupDescriptor PropertyName="Folder"/>
</dataSource:DataSource.GroupDescriptors>
</dataSource:DataSource>
</xForms:SfListView.DataSource>
</xForms:SfListView>
I have tried to add following element but it cause that no Group label is shown.
<xForms:SfListView.GroupHeaderTemplate>
<DataTemplate x:DataType="model:DashboardDevice">
<Label x:Name="label" Text="{Binding Key}" TextColor="{StaticResource ColorText}" FontSize="20" Padding="10,10,0,0" />
</DataTemplate>
</xForms:SfListView.GroupHeaderTemplate>
Tnanks for help,
Tomas
|
<ContentPage xmlns:result="clr-namespace:Syncfusion.DataSource.Extensions;assembly=Syncfusion.DataSource.Portable">
…
<syncfusion:SfListView.GroupHeaderTemplate>
<DataTemplate x:DataType="result:GroupResult">
<Label x:Name="label" Text="{Binding Key}" TextColor="{StaticResource ColorText}" FontSize="20" Padding="10,10,0,0" />
</DataTemplate>
</syncfusion:SfListView.GroupHeaderTemplate>
…
</ContentPage> |
Thanks a lot for help.
Tomas