In my .NET8 MAUI
application, I have a Label
and the Text
of the Label
is coming from the code behind
<Label
x:Name="lblDropDown"
Text="{Binding Placeholder, Source={x:Reference this}}"
TextColor="{Binding TextColor, Source={x:Reference this}}"
FontSize="{Binding TextSize, Source={x:Reference this}}"
FontFamily="{Binding TextFontFamily, Source={x:Reference this}}">
<Label.Triggers>
<MultiTrigger TargetType="Label">
<MultiTrigger.Conditions>
<BindingCondition
Binding="{Binding Text, Source={x:Reference this}}"
Value="{Binding Placeholder, Source={x:Reference this}}" />
</MultiTrigger.Conditions>
<Setter Property="TextColor" Value="{Binding PlaceholderColor}" />
</MultiTrigger>
<DataTrigger TargetType="Label"
Binding="{Binding Text, Source={x:Reference this}}"
Value="{Binding Placeholder, Source={x:Reference this}}">
<Setter Property="TextColor" Value="{Binding PlaceholderColor}" />
</DataTrigger>
</Label.Triggers>
</Label>
<Label Text="{Binding Text, Source={x:Reference this}}" />
and the result is as followed
The issue is that I can’t check with the MultiTrigger
when, for example, the Text
has the same initial value to change the color. For example, I like to change the color of the text to grey (PlaceholderColor
) when the Text
of the Label
is the same as the Placeholder
.
In the last line of the XAML, you see I display the value of the Text
. This value is the same value as Placeholder
but the BindingCondition
nor DataTrigger
is applied.