locked
AppBar PopupMenu position?

    Question

  • 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 }).then(...

    Any ideas?

    Friday, September 21, 2012 2:29 PM

All replies

  • Hi Robert,

    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


    Jeff Sanders (MSFT)

    Wednesday, September 26, 2012 1:35 PM
    Moderator
  • Hi, 

    I had the exact same issue and wanted to display the menu on top of the AppBar, like a flyout. I used the Menu component instead, see this article

    http://www.dotnetcurry.com/ShowArticle.aspx?ID=833

    You can give it an achor at the show method and a placement. So basically for a bottom AppBar

    myMenu.show(myButtonInAppBar, 'top');

    Fabien

    Sunday, September 30, 2012 6:24 PM