In my .NET maui app I created a menu like this:
But now I want to give MenuBarItems functions when clicked on. For instance, How would I close the form when a user clicks on the Exit MenuBarItem?
I tried adding Command= but that didn't seem to work. Any help is appreciated. Thanks.

Bob GattoPosted Apr 19, 2023, 6:58 PM
When I used the Clicked In the MenuBarItem it came back with a message saying:
The property 'Clicked' was not found in type 'MenuBarItem'
is ther another way?
Tuhin PaulPosted Apr 19, 2023, 2:05 AM
Sample Code:
the Clicked event handler method is named Exit_Clicked and is called when the Exit MenuBarItem is clicked. In the method, the form is closed using the Navigation.PopAsync() method.
Tuhin PaulPosted Apr 19, 2023, 2:04 AM
You can handle the click event of the MenuBarItem to execute the desired function. In this case, to close the form when the Exit MenuBarItem is clicked, you can add the Clicked event handler to the MenuBarItem element and add the code to close the form in the event handler method.