Binding CheckBox multiple conditions for data trigger in WPF?

667 Views Asked by At

I have a problem with binding CheckBox to multiple conditions for data trigger. I'm trying to change the background of DataGridRow with two conditions.

First - CheckBox IsChecked.

Second - DataGridCell value is 1.

Here is my code

<CheckBox x:Name="chkTehnickaPodrska" Content="Oboj tikete kojima je istekla teh. podrška" Margin="5" IsChecked="True"/>

<Style.Triggers>
      <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding IsChecked, ElementName=chkTehnickaPodrska}" Value="True"/>
            <Condition Binding="{Binding [Istekla tehnička podrška]}" Value="1"/>
          </MultiDataTrigger.Conditions>
          <Setter Property="Background" Value="Red"/>
      </MultiDataTrigger>
</Style.Triggers>
1

There are 1 best solutions below

0
IceCode On

You can use a converter in your second conditional binding:

<Condition Binding="{Binding Converter={StaticResource CellValueConverter}}" Value="1"/>

And handle your bound data in the converter.