Silverlight Datagrid 选择右键单击

编程入门 行业动态 更新时间:2024-10-27 20:30:04
本文介绍了Silverlight Datagrid 选择右键单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

有没有办法让右键单击事件在工具包数据网格中选择一行?

Is there a way for a right click event to select a row in toolkit datagrid?

我正在使用运行良好的工具包上下文菜单,但问题是,只有左键单击才能选择行,如果我希望上下文菜单正常工作,我需要右键单击才能执行此操作.

I'm using toolkit context menu which works nicely, but the problem is, only left click is able to select rows, and I need right click to be able to do that if I want my context menu to work properly.

感谢任何帮助

推荐答案

您可以找到解决方案 此处.

You can find a solution here.

基本上是这样的:

private void dg_LoadingRow(object sender, DataGridRowEventArgs e)
{
    e.Row.MouseRightButtonDown += new MouseButtonEventHandler(Row_MouseRightButtonDown);
}
void Row_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
    dg.SelectedItem = ((sender) as DataGridRow).DataContext;
}

这篇关于Silverlight Datagrid 选择右键单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-01 16:16:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/834269.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:右键   单击   Silverlight   Datagrid

发布评论

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

>www.elefans.com

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