vendredi 2 septembre 2016

Trigger "Checked/Unchecked" not firing in three state checkbox

I am using the following code to implement three state checkbox using MVVM:

<CheckBox IsChecked="{Binding Path=IsValueChecked, 
    Mode=TwoWay, 
    UpdateSourceTrigger=Explicit}"
    Margin="3,10,0,0"
    IsThreeState="True">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Checked">
            <i:InvokeCommandAction Command="{Binding Path=CheckCommand, 
                RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
        </i:EventTrigger>

    <i:EventTrigger EventName="Unchecked">
        <i:InvokeCommandAction Command="{Binding Path=CheckCommand, 
            RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</CheckBox>

And in viewmodel, a notifiable property "IsValueChecked" of type Nullable<bool> is created. The problem is that the event "Checked" and "Unchecked" are not triggered on clicking of checkbox. What am i missing, Please suggest.

Thanks in Advance!




Aucun commentaire:

Enregistrer un commentaire