有时需要在Silverlight项目中禁止掉默认的右键菜单,解决方法很简单,只要给根节点加上MouseRightButtonDown事件处理程序即可,代码如下:
LayoutRoot.MouseRightButtonDown += (sender,e) =>
{
e.Handled=true;
};
LayoutRoot.MouseRightButtonDown += (sender,e) =>
{
e.Handled=true;
};
本文介绍了一种简单的方法来禁用Silverlight应用程序中的默认右键菜单功能。通过为根布局元素添加MouseRightButtonDown事件处理程序,并设置e.Handled为true,可以有效阻止默认上下文菜单的显示。
89

被折叠的 条评论
为什么被折叠?