Событие снятия проверки WPF CheckBox не запускается

У меня есть флажок внутри ItemsControl. У него есть EventTrigger для событий Checked и UnChecked. Он также привязан к Command с несколькими CommandParameters. Событие Checked запускается нормально.

Однако событие UnChecked не срабатывает. Что мне не хватает?

    <ItemsControl Grid.Column ="2" 
                  Grid.Row    ="0" 
                  ItemsSource ="{Binding ParameterOptionGroup.ParameterOptions}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <CheckBox IsChecked="{Binding State, Converter={StaticResource BoolToEntityState}, Mode=OneWay}">
                    <trigger:Interaction.Triggers>
                        <trigger:EventTrigger EventName="Checked">
                            <trigger:InvokeCommandAction  Command ="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, 
                                                             Path=DataContext.InitiateParameterAnswer}">
                                <trigger:InvokeCommandAction.CommandParameter>
                                    <MultiBinding Converter="{StaticResource GuidAndParameterOptionToTuple}">
                                        <Binding Path="DataContext" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type CheckBox}}"></Binding>
                                        <Binding Path="DataContext.Id" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}"></Binding>
                                        <Binding Path="Text" ElementName="txtRemarks" />
                                        <Binding Source="True" />
                                        <Binding Source="10" />
                                    </MultiBinding>
                                </trigger:InvokeCommandAction.CommandParameter>
                            </trigger:InvokeCommandAction>
                        </trigger:EventTrigger>
                    </trigger:Interaction.Triggers>
                    <trigger:EventTrigger EventName="UnChecked">
                        <trigger:InvokeCommandAction  Command ="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, 
                                                             Path=DataContext.InitiateParameterAnswer}">
                            <trigger:InvokeCommandAction.CommandParameter>
                                <MultiBinding Converter="{StaticResource GuidAndParameterOptionToTuple}">
                                    <Binding Path="DataContext" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type CheckBox}}"></Binding>
                                    <Binding Path="DataContext.Id" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}"></Binding>
                                    <Binding Path="Text" ElementName="txtRemarks" />
                                    <Binding Source="False" />
                                    <Binding Source="5" />
                                </MultiBinding>
                            </trigger:InvokeCommandAction.CommandParameter>
                        </trigger:InvokeCommandAction>
                    </trigger:EventTrigger>
                </CheckBox>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>

person Jose Capistrano    schedule 01.05.2015    source источник
comment
Вы пробовали «Без проверки» вместо «Не проверено»?   -  person Bort    schedule 01.05.2015
comment
Ух ты. Я так близок к тому, чтобы все это переписать! Для меня это был долгий день, спасибо!   -  person Jose Capistrano    schedule 01.05.2015


Ответы (1)


Как указал @Bort, имя события должно быть Unchecked вместо UnChecked.

person Jose Capistrano    schedule 01.05.2015