ListBoxI 在xaml里只能添加PreviewMouseDown事件和SelectedChange事件,没有ListBoxItem点击事件,可以通过下面的方式添加点击事件
this.stencilListBox.AddHandler(UIElement.MouseDownEvent,
new MouseButtonEventHandler(StencilMouseDown), true);
参考:
本文探讨了在WPF应用中使用ListBox时,如何通过编程方式为ListBox项添加点击事件,解决事件响应机制的限制。通过实例演示了使用AddHandler方法实现自定义事件处理,提供了解决方案供开发者参考。
ListBoxI 在xaml里只能添加PreviewMouseDown事件和SelectedChange事件,没有ListBoxItem点击事件,可以通过下面的方式添加点击事件
this.stencilListBox.AddHandler(UIElement.MouseDownEvent,
new MouseButtonEventHandler(StencilMouseDown), true);
您可能感兴趣的与本文相关的镜像
Stable-Diffusion-3.5
Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

被折叠的 条评论
为什么被折叠?