mardi 28 juin 2016

Changing states of checkbox with even trigger

I have this CheckBox:

<CheckBox x:Name="checkNotAppointed" Grid.Column="1" Grid.Row="2" Content="Not Appointed" >
    <CheckBox.Style>
        <Style TargetType="{x:Type CheckBox}">
            <Setter Property="Margin" Value="2" />
            <Setter Property="IsEnabled" Value="True" />
            <Setter Property="IsChecked" Value="{Binding FilterForNotAppointed, UpdateSourceTrigger=PropertyChanged}" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsChecked, ElementName=checkElder}" Value="True" />
                        <Condition Binding="{Binding IsChecked, ElementName=checkMinisterialServant}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="IsEnabled" Value="True" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsChecked, ElementName=checkElder}" Value="False" />
                        <Condition Binding="{Binding IsChecked, ElementName=checkMinisterialServant}" Value="True" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="IsEnabled" Value="True" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsChecked, ElementName=checkElder}" Value="False" />
                        <Condition Binding="{Binding IsChecked, ElementName=checkMinisterialServant}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="IsChecked" Value="True" />
                    <Setter Property="IsEnabled" Value="False" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>
    </CheckBox.Style>
</CheckBox>

If I untick either checkElder or checkMinisterialServant it has no affect on checkNotAppointed. Correct.

If I then untick both of them, it checks the checkNotAppointed and disables. Correct.

If I then check one of the other two, it enables checkNotAppointed but always unchecks it. Why?




Aucun commentaire:

Enregistrer un commentaire