Hello,
Welcome to Microsoft Q&A!
For your requirement, you can simply use flyout to achieve it. Flyouts can be attached to Button, when you click the Button, it will appear above the button by default and when you click the Button again or other places, the Flyout will display. For more information about how to achieve it, you can check the following txt file which contains the xaml layout.
Thanks.