MouseLeftButtonDown事件问题
我在 telerik 网格内有以下格式的行。
| WordFile.doc|button1|_button2_|
当用户单击第 1 列[WordFile.doc] 时,我需要显示一个弹出窗口。我在数据网格行中有两个按钮,它们附加了单击事件。早期的 mousedoubleclick 事件已附加到行,一切正常。
现在为了使该行响应单击。我在后面的代码中添加了以下语句,
this.radUSBFiles.AddHandler(GridViewCell.MouseLeftButtonDownEvent, new MouseButtonEventHandler(row_MouseDoubleClick), true);
此后按钮停止工作。我相信 MouseLeftButtonDownEvent 不会让控件到达按钮的事件处理程序。
我正在尝试计算发生单击的列号,如果单击发生在按钮列以外的任何区域,则将 Handled 设置为 true。
对此有更好的方法吗?
请建议,
问候,
约翰。
I have the rows inside a telerik grid in following format.
| WordFile.doc|button1|_button2_|
I need to display a popup when the user click on column 1[WordFile.doc]. I have two buttons in a data grid row which have click event attached to it. Earlier mousedoubleclick event was attached to row and everything was working fine.
Now in-order to make the row respond to the single click. I added the following statement to my code behind
this.radUSBFiles.AddHandler(GridViewCell.MouseLeftButtonDownEvent, new MouseButtonEventHandler(row_MouseDoubleClick), true);
After this the buttons stopped working. I believe the MouseLeftButtonDownEvent is not letting the control reach the event handlers of the button.
I am trying to calculate the column number where the click happend and set the Handled to true if the click happens on any area other than button columns.
Is there any better approach to this?
Please advice,
Regards,
John.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了了解您单击了哪一列,请将 commandname 属性附加到该列并在 ItemCommand 事件中处理它。
网格列标记:
检查 itemcommand 事件中的命令名(后面的代码):
if commandname == "View" { ....在这里做点什么.....}
请参阅 此链接了解更多信息。
For you to know on what column you clicked, attach a commandname property to the column and handle it in the ItemCommand event.
Grid column mark up:
check for the commandname in the itemcommand event (code behind):
if commandname == "View" { ....do something here.....}
See this link for more info.