So i have this Enum
:
public enum Status
{
Intermediate = 0,
Valid,
NotValid
}
My ViewModel
:
public class MyData
{
private Status _status;
public Status Status
{
get { return _status; }
set
{
_status= value;
OnPropertyChanged();
}
}
My TextBox Style
:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Status.Valid}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="LightSeaGreen" />
</MultiDataTrigger>
So this Status
property is changing and i verify the it become Valid
but still my TextBox
Background
color not changing.
This style
is define in other ResourceDictionary
file.
The name of this file is TextBox.xaml
.
Other properties works fine, the reason i am asking is that i never try to write Trigger
with enum
so i even dont know how to do that.
Try this:
<Condition Binding="{Binding Status}" Value="Valid"/>
Or
<Condition Binding="{Binding Status}" Value="{x:Static local:Status.Valid}"/>
...where local
is mapped against the CLR namespace of Status
.
xmlns:local="clr-namespace:WpfApplication1"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With