数据网格中的按钮单击事件 [英] Button click event in datagrid

查看:83
本文介绍了数据网格中的按钮单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在wpf中的datagrid的单元格模板中添加了按钮,单击按钮事件将触发行选择更改事件而不是按钮单击事件。我需要这两个事件。我如何区分这两个事件?在c#code。

解决方案

中查看SelectionChangedEventArgs的OriginalSource属性,它告诉如果它是一个按钮,引发了什么控件引发了事件,那么你可以应用check来跳过事件处理程序中的代码

Added button in cell template of the datagrid in wpf,On click of button event will hit the row selction changed event instead of button click event. i need both events.How can i Distinguish both events? in c# code.

解决方案

see OriginalSource property of SelectionChangedEventArgs, which tells what control raised the event if it is a button then you may apply check to skip code in event handler


这篇关于数据网格中的按钮单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆