DataGridTextColumn事件绑定

编程入门 行业动态 更新时间:2024-10-23 12:31:38
本文介绍了DataGridTextColumn事件绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

将ICommand绑定到DataGridTextColumn的最简单的方法是什么,这将处理用户双击该列而不使用代码?我可以以某种方式暴露一个底层的FE,并在XAML中做到这一切吗?

What is the simplest way to bind an ICommand to a DataGridTextColumn that will handle a user double click on that column without code behind? Can I somehow expose an underlying FE and do it all in the XAML?

这个特定的列是只读的,这里是xaml:

This particular column is read only and here is the xaml for it:

<dg:DataGridTextColumn Header="Number" Binding="{Binding BusinessId}" Width="75" IsReadOnly="True" CanUserReorder="False" />

干杯, Berryl

Cheers, Berryl

推荐答案

简短的答案是否。

你不能在xaml的列上创建一个新的命令属性。在处理这个问题的过去,我:

you cant create a new command property on a column in xaml. In the past when dealing with this problem I:

  • 从列中派生并添加命令

  • derive from the column and add the command

从网格派生并覆盖预览onmousedoubleclick方法

derive from the grid and override the preview onmousedoubleclick method

  • 在托管网格的表单后面的代码中放置一个事件处理程序

然后

  • 计算哪个单元格被双击

  • calculate which cell was double clicked on

获取其父列。

如果它是带有extra命令属性的派生类型的列,请激活命令在列上,或者在派生网格上有命令,并发送列作为命令参数。

if it was a column of the derived type with the extra command property, fire the command on the column, or have the command on the derived grid and send the column as the command parameter.

更多推荐

DataGridTextColumn事件绑定

本文发布于:2023-11-03 12:45:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555167.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   事件   DataGridTextColumn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!