右键单击上下文菜单 [英] Right click context menu

查看:75
本文介绍了右键单击上下文菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个拖动画布,它的子元素是textblock,另外一个按钮是按钮.
右键单击按钮或文本块时,将显示包含菜单项delete和deleteall的上下文菜单.

单击删除后如何从文本块或按钮中识别菜单项

I have a drag canvas and its child elements are textblock, button abd another canvas.
On right click of button or textblock contextmenu is displayed containing menuitem delete and deleteall.

On click of delete how to identify the menuitem is from a textblock or a button

推荐答案

要添加到Eddy的答案中,您将执行以下操作:

To add to Eddy''s answer, you would do something like this:

if (sender is TextBlock)
{
    // ... do something 
}
else if (sender is Button)
{
    // ... do something 
}






在引发方法的方法中检出sender对象:)
Check out the sender object in the method that get''s raised :)


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

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