Can a trigger change class properties?
I mean not only to change something on the form, but also the internal public property of the form. At me it is impossible in a setter of the trigger in Property
interpose binding to the necessary property. (gives a compilation error)
I will give an example:
<CheckBox> <CheckBox.Style> <Style TargetType="CheckBox"> <Style.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter Property="{Binding Path=Value, Mode=OneWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" Value="False"/> </Trigger> </Style.Triggers> </Style> </CheckBox.Style> </CheckBox>
Binding
cannot be set in the property of the Setter
type. Binding
can only be set in the DependencyProperty
parameter of a DependencyObject
.