K
K
kot25662021-10-25 10:24:23
WPF
kot2566, 2021-10-25 10:24:23

How to bind Style to field value?

There is such a button inside the DataGrid. The IsChecked property, which is equal to the boolean value of the isActive field .

<ToggleButton IsChecked="{Binding Path=isActive, UpdateSourceTrigger=PropertyChanged}"  Style="{ StaticResource ToggleButtonIcon}" Name="theCheckbox" Click="theCheckbox_Click"  />


What should be written in the Style parameter so that the element changes color?
That is, for the Style to also depend on the value of isActive , only the values ​​of ToggleButtonIcon and ToggleButtonIconSuccess .

As, for example, it is set in VUE..JS:
Style="{  StaticResource ToggleButtonIcon : isAcive==true,  StaticResource ToggleButtonIconSuccess : isAcive==false}"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question