View视图里面的代码,自定义的表头双击事件,必须在控件里面加属性MouseAction=“LeftDoubleClick”,不然双击没有效果,因为用的是MVVM框架,所以要绑定点击事件 Command="{Binding DataContext.TimeQuantumScreen,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGrid}} "
WPFMVVM DataGrid表头双击事件

在ViewModel写好方法,到视图绑定就行了,这样就能实现双击事件了
WPFMVVM DataGrid表头双击事件

如图,双击表头改变背景颜色以及弹出窗体,效果如下

WPFMVVM DataGrid表头双击事件

相关文章:

  • 2021-08-17
  • 2022-12-23
  • 2022-02-25
  • 2021-05-20
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2021-07-12
  • 2022-03-07
  • 2022-12-23
相关资源
相似解决方案