WPF 捕获ListBoxItem 点击事件

来源:互联网 发布:蓝牙耳机在淘宝属于 编辑:程序博客网 时间:2024/05/01 14:08

ListBoxI 在xaml里只能添加PreviewMouseDown事件和SelectedChange事件,没有ListBoxItem点击事件,可以通过下面的方式添加点击事件

            this.stencilListBox.AddHandler(UIElement.MouseDownEvent,                new MouseButtonEventHandler(StencilMouseDown), true);

参考:

http://stackoverflow.com/questions/1271375/how-to-capture-a-mouse-click-on-an-item-in-a-listbox-in-wpf

0 0
原创粉丝点击