AppBar PopupMenu的位置? [英] AppBar PopupMenu position?

查看:89
本文介绍了AppBar PopupMenu的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个appbar按钮。单击时,我正在创建一个PopupMenu并向其附加命令。当菜单出现时,它会显示在您单击鼠标的确切位置。我希望它显示在appbar按钮的顶部,而不是鼠标
光标。这就是我显示菜单的方式:

I have an appbar button. When clicked, I'm creating a PopupMenu and appending commands to it. When the menu appears, it appears over the exact point where you clicked the mouse. I want it to appear over the top of the appbar button, not at the mouse cursor. This is how I am showing the menu:

menu showAsync ({ x e clientX y e clientY
})。然后(...

menu.showAsync({ x: e.clientX, y: e.clientY }).then(...

任何想法?

推荐答案

嗨罗伯特,

在更改默认行为之前,请考虑保持原样。 每个人都希望它从您点击的位置出现。 如果您想要更改此行为,您可以计算并指定X和Y参数是你想要的! 
例如,获取按钮的坐标和大小,并确定你想要如何移动点(菜单将位于中心和上方点)。

Before changing the default behavior consider leaving it as it is.  Everyone will expect it to come up from where you click.  If you want to change this behavior you can calculate and specify the X and Y parameters to be what every you wish!  For example, get the coordinates and size of your button and determine how you want to move the point (the menu will be centered on and above the point).

-Jeff


这篇关于AppBar PopupMenu的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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