BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
I have a SfListView with an ItemTemplate which has 3 labels in it, I want to be able to change teh second labels color using a IValueVonverter, I can get the converter called no problem however the text value of the label is always null, the label is bound to a datasource column.
<ContentPage.Resources>
<ResourceDictionary>
<local:ColorConverter x:Key="ColorConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<Grid RowDefinitions="*">
<syncfusion:SfListView x:Name="listView" BackgroundColor="DarkGrey" ItemsSource="{Binding TheCameraHealth}" ItemSize="300" EmptyView="Loading......" AutoFitMode="Height">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Border StrokeThickness="4" HorizontalOptions="Center" StrokeShape="RoundRectangle 20,0,0,20" Stroke="Gray" BackgroundColor="LightGray" >
<Grid RowDefinitions="*,*,*" RowSpacing="5">
<Label Margin="20,0,0,0" Grid.Row="0" Grid.Column="0" Text="{Binding CameraName}" TextColor="Black" FontAttributes="Bold" FontSize="16"/>
<Label x:Name="status" Margin="25,0,0,0" Grid.Row="1" Grid.Column="0" Text="{Binding TheCameraStatus}" FontAttributes="Bold" TextColor="{Binding TheCameraStatus, Converter={StaticResource Key=ColorConverter},ConverterParameter={x:Reference Name=status}}"/>
<Label Margin="24,0,0,0" Grid.Row="2" Grid.Column="0" Text="{Binding TheCameraReads}" TextColor="Black" />
</Grid>
</Border>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
<syncfusion:SfListView.ItemsLayout>
<syncfusion:GridLayout x:Name="gridLayout" SpanCount="4" />
</syncfusion:SfListView.ItemsLayout>
</syncfusion:SfListView>
</Grid>
Hi Terence,
We could understand the reported scenario and experienced the same case in a simple demo with framework Label alone. It seems, converter is triggered prior to the text being bound to the Label. As this is framework behavior, we are unable to address it on our end.
<Grid> <Label x:Name="status" Margin="25,0,0,0" Grid.Row="1" Grid.Column="0" Text="{Binding Comments}" FontAttributes="Bold" TextColor="{Binding Comments, Converter={StaticResource Key=ColorConverter}, ConverterParameter={x:Reference Name=status}, Mode=TwoWay}" /> </Grid>
|
Regards,
Diwakar