Hello Community ,
i witnessed a strage behaviour in my xamarin forms app.
My xaml looks like this:
<Grid ColumnSpacing="1" RowSpacing="2" Padding="10">
<StackLayout Orientation="Horizontal" Grid.Row="0">
<Label Style="{StaticResource leftLabel}" Text="Caption" />
<Label Style="{StaticResource **rightLabel**}">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding MyModel.DateTimeProperty,
Converter={StaticResource IsGreaterDateTimeConverter}}" Value="True">
<Setter Property="Text" Value="{Binding MyModel.DateTimeProperty, StringFormat='{0:dd.MM.yyyy}'}"/>
</DataTrigger>
</Label.Triggers>
</Label>
</StackLayout>
</Grid>
Thats my StaticResource for the "rightLabel":
<Style x:Key="rightLabel" TargetType="Label">
<Setter Property="VerticalTextAlignment" Value="Center"></Setter>
<Setter Property="HorizontalTextAlignment" Value="End"></Setter>
<Setter Property="Margin" Value="0,0,10,0"></Setter>
<Setter Property="HorizontalOptions" Value="FillAndExpand"></Setter>
<Setter Property="TextColor" Value="#4b4b4b"></Setter>
</Style>
Now the issue:
The DateTimeProperty implements INotifyPropertyChanged. After the labels text is updated by the datatrigger, the Style "HorizontalTextAlignment="End" isnt working anymore.
The ValueConverter checks if the DateTime is greater than a fix DateTime Value and returns the boolean result.
Does anyone has witnessed a similar behaviour or knows how to fix it?
Thank you very much, Patrick