androidmenumaui

How to open menu programmatically in Android MAUI App?


I'm building a MAUI app for android devices that have physical keyboard (and want to open menu by using hotkeys). I know how to handle keyboard but I just can't find a way to open menu (3 dots) programmatically : enter image description here I'm not using shell. Menu items are added on xml side as: <ToolbarItem Order="Secondary" ... Any ideas ?

I've tried to open it by using Platform.CurrentActivity.OpenOptionsMenu(); Platform.CurrentActivity.OpenContextMenu(); It doesn't do anything tho.


Solution

  • On Android platform, the 3 dots of the toolbar can be opened through the OpenOptionsMenu() method.

    After my testing, MAUI currently does not support adding Toolbar native controls to the page (either in the .cs or .xaml file; they can only add or get the ToolbarItems), the three points cannot be opened through the OpenOptionsMenu() method.

    So it is recommended that you post this feature request to MAUI github