首页 WinForm/WPF WPF之CheckBox的unchecked和Checked的Command事件不触发

WPF之CheckBox的unchecked和Checked的Command事件不触发

作者:胡同里的砖头 围观群众:190 更新于:2023-10-27

一定要引用命名空间:xmlns:behav="http://schemas.microsoft.com/xaml/behaviors

xmlns:behav="http://schemas.microsoft.com/xaml/behaviors"
<Border Grid.Row="1" Grid.Column="0" BorderThickness="2" Grid.RowSpan="3" BorderBrush="{StaticResource MainMenuColor}">
<ListBox ItemsSource="{Binding ListBoxItems}" Background="Transparent" Foreground="{StaticResource MainMenuColor}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox FontFamily="{StaticResource FontProtokoll}" IsChecked="{Binding IsChecked}" Content="{Binding Path=Text}" Foreground="{StaticResource MainMenuColor}">
<behav:Interaction.Triggers>
<behav:EventTrigger EventName="Checked">
<behav:InvokeCommandAction Command="{Binding CheckedOrUncheckedCommand}"/>
</behav:EventTrigger>
</behav:Interaction.Triggers>
</CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>

  • 本文标题: WPF之CheckBox的unchecked和Checked的Command事件不触发
  • 文章分类:【WinForm/WPF】
  • 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.
留言评论
站点声明:
1、本站【胡同里的砖头】个人博客,借鉴网上一些博客模板,取其各优点模块自行拼装开发,本博客开发纯属个人爱好。
2、所有笔记提供给广大用户交流使用,可转载,可复制,纯个人开发所遇问题锦集记录使用
Copyright © huzlblog.com All Rights Reserved. 备案号:苏ICP备2021056683号-8