maui
maui copied to clipboard
Disabling a MenuBarItem doesn't stop its sub-items from appearing when clicked
Description
If a top-level MenuBarItem
, with sub-items, has its IsEnabled
property set to false
then the sub-items still appear when the menu bar item is clicked. This is contrary to expectation. Verified on Windows only.
Steps to Reproduce
-
Create a File->New .NET Maui app
-
In
MainPage.xaml
add a top-level menu with a single subitem by adding the following after the start of the<ContentPage>
element and before the start of its nested<ScrollView>
element:
<ContentPage.MenuBarItems>
<MenuBarItem Text="File">
<MenuFlyoutItem Text="Exit" />
</MenuBarItem>
</ContentPage.MenuBarItems>
- In
MainPage.xaml.cs
add anOnAppearing()
method to theMainPage
class and disable the top-levelMenuBarItem
:
protected override void OnAppearing()
{
base.OnAppearing();
MenuBarItems[0].IsEnabled = false;
}
- Run the app and click the File menu. The dropdown still appears.
Link to public reproduction project repository
https://github.com/andyjohnson0/MauiMenuItemEnableIssue
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 10.0.17763.0
Did you find any workaround?
No
Relevant log output
No response
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.