I have a button with a default command and a context menu for other available commands:
<Button Content="Do this" Height="23" Width="75" Command="local:MyCommands.ThisCommand"> <Button.ContextMenu> <ContextMenu> <MenuItem Header="Do this" Command="local:MyCommands.ThisCommand" /> <MenuItem Header="Do that" Command="local:MyCommands.ThatCommand" /> </ContextMenu> </Button.ContextMenu> </Button>
在默认情况下,在出现的右键菜单开始在光标的热点:
By default, the context menu appears starting at the hot spot of the cursor:
不过,我希望它出现在一个固定的相对位置,按钮(假的,编辑截图)下:
However, I'd like it to appear at a fixed relative position, beneath the button (fake, edited screenshot):
设置上下文菜单中的展示位置, PlacementRectangle 和 PlacementTarget 性质似乎并没有做任何事情;上下文菜单中坚持挂光标,无论我用鼠标右键单击我的按钮。更糟的是,聚焦按钮,击中菜单键使上下文菜单坐在按钮前,完全阻止它。
展示位置
PlacementRectangle
PlacementTarget
Setting the context menu's Placement, PlacementRectangle and PlacementTarget properties doesn't seem to do anything; the context menu insists on hanging off the cursor wherever I right-click my button. Worse, focusing the button and hitting the menu key causes the context menu to sit in front of the button, blocking it completely.
Placement
那么,究竟如何我指定的上下文菜单中应该出现在按钮下方?
So, how exactly do I specify that the context menu should appear beneath the button?
查看下ContextMenu.Placement
和尝试这种
<Button Content="Do this" Height="23" Width="75" ContextMenuService.Placement="Bottom" Command="local:MyCommands.ThisCommand"> <Button.ContextMenu> <ContextMenu> <MenuItem Header="Do this" Command="local:MyCommands.ThisCommand" /> <MenuItem Header="Do that" Command="local:MyCommands.ThatCommand" /> </ContextMenu> </Button.ContextMenu> </Button>
相关推荐
神经心理学(2023最新神经心理学百科介绍)
阿斯顿·马丁(英国汽车制造商)
塞尔吉奥·罗切特(乌拉圭男子足球运动员)
札瑞·朗德尔(札瑞·朗德尔)
中泽启治(中泽启治)
吉林农业科技学院电气与信息工程学院(教育机构)
傻瓜就是我(1999年比莉演唱歌曲)
用我自己的Android应用程序/ APK的发射器/主屏幕更换自己的、
C#:访问32位/ 64位的DLL取决于平台平台、DLL
Twig 中的 {{ exception.message }} 不呈现 HTMLexception、Twig
验证(XSD)对XML的机器人机器人、XSD、XML
为什么该任务的结果属性非通用任务(C#4.0 +)不可用?任务、不可用、属
羊绒被要被套吗 羊绒被可以直接盖吗_羊绒被被压缩后可以恢复原状
最简单小兔子折纸图解_折纸兔子的折法图解 折纸兔子的步骤详解
中药调理脾胃有哪些方法_吃中药调理脾胃的方法
彩钢瓦多少钱_附近出售二手彩钢瓦多少钱
补肾最好的药有哪些_补肾固精的药有什么
锅贴豆香椒的做法_豆香冬瓜的做法
锻炼眼力的几种方法_腰部锻炼保健的几种方法
香辣鱿鱼须,这样做味道更鲜美_香辣鱿鱼酥怎么做
最新文章
蒙牛酸酸乳(是中国蒙牛公司研发的乳饮料)
360手机f4
打召村(打召村)
王雅琪(中国内地女艺人)
里面shapes.xml在安卓多发性形状形状、多发性、里面、xml
为什么会出现这种跨域Ajax调用实际工作?实际、工作、Ajax
继续任务后所有任务完成任务、继续
LINQ的 - 什么是找出延迟执行或不是最快的方法是什么?最快、不是、
自建房屋买卖协议参考模板_房屋买卖协议(借款)模板
国家赔偿的适用范围是什么_不属于国家赔偿范围的是什么
1. 元旦节_2. 春节
皮肤腺样囊性癌的治疗方法_皮肤色素沉着的治疗方法
炒面筋的做法有哪些?_黑木耳梅豆炒面筋的做法
像动物“偷师”真的不可耻_动物饼干的做法有什么
电饭煲/土司披萨的做法_时蔬香肠土司披萨的做法
感冒用的消炎药有哪些呢_感冒要吃消炎药吗
梨蓉沙冰的做法_桃味牛奶沙冰的做法
激光治疗雀斑好吗?原来有这么多好处_激光去除雀斑需要了解的知识
原来这些招让皮肤这么好_4招赶走皮肤暗黄
石金钱龟幼龟的饲养方法及要点(石龟幼龟的饲养方法是什么)