When reading a DataTrigger on MSDN it says:
Represents a trigger that applies property values ββor performs an action when the associated data meets a specified condition.
It means
When the trigger is correct, it changes the value to the desired value.
But can this be done?
When it is no longer true, it returns the value to the previous value.
How did I come to this conclusion
I did it
<Style x:Key="fd" TargetType="SomeControl">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Button Content="Foo" x:Name="mybutton">
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=FooProperty}"
Value="Collapsed">
<Setter Property="IsEnabled" Value="False" TargetName="mybutton"/>
<Setter Property="Opacity" Value="0.5" TargetName="mybutton"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
When reset, FooPropertyit changes mybutton IsEnabledto Falseand Opacityto0.5
, FooProperty , mybutton IsEnabled True Opacity 1, .
DataTrigger . ?
, - Microsoft/MSDN, ?