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 .

  • You should not want this. It seems that you are solving some problem with means not intended for this. Describe what you really need to get your real task. - VladD
  • Everything I have done differently. - PECHAURIST

1 answer 1

Triggers are intended primarily for styling. To work with "internal" logic, it is still better to handle events.