【问题标题】:How to get the item at the mouse position when I perform a Double Click on DataGrid in WPF?在WPF中双击DataGrid时如何在鼠标位置获取项目?
【发布时间】:2012-02-03 02:28:20
【问题描述】:

我是 WPF 新手,我有一个关于 DataGrid 的问题,当我在 DataGrid 上执行双击时,如何在鼠标位置获取项目?

【问题讨论】:

  • @H.B.伟大的!它解决了我的问题。
  • 很高兴听到这个消息。如果您想保留这个问题,它应该有一个正确的答案,为此我现在添加了一个......

标签: wpf datagrid


【解决方案1】:

您可以使用StyleEventSetter 订阅DoubleClick 事件,对于行使用RowStyle,对于特定单元格使用CellStyle

然后,您可以在处理程序中将sender 分别转换为DataGridRowDataGridCell

([Example with rows])

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-09
    • 1970-01-01
    • 2014-04-24
    • 2011-09-25
    • 2013-05-08
    • 2010-11-19
    • 2013-03-26
    • 1970-01-01
    相关资源
    最近更新 更多