Perhaps WPF, trigger-based change bindings?

I have a usercontrol that when you change one property, the bindings change for several different built-in controls (in the same user control). Before spending too much time, is this something you can do with Trigger or DataTrigger? I can do this in code, but it seems dirty.

+4
source share
1 answer

Undoubtedly, the following Text property binds shiftButtonText when the IsPressed property of the current DataContext changes. Is this the type of thing you're looking for?

<DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=IsPressed}" Value="True"> <Setter TargetName="shiftButtonText" Property="Text" Value="{Binding Path=PressedText}"/> </DataTrigger> </DataTemplate.Triggers> 

Hope this helps,

+7
source

Source: https://habr.com/ru/post/1286186/


All Articles