-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
area-controls-menubarDesktop MenuBarItemsDesktop MenuBarItemsarea-controls-shellShell Navigation, Routes, Tabs, FlyoutShell Navigation, Routes, Tabs, Flyoutarea-navigationNavigationPageNavigationPaget/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
Since MenuBarItem did not had command binding option, I chose MenuFlyoutItem. But when doing navigation in it, it stops command in menu bar from working. It doesn't crash but it stops working.
Steps to Reproduce
Add to MainPage.xaml:
<ContentPage.MenuBarItems>
<MenuBarItem Text="Pages">
<MenuFlyoutItem Text="Page1"
Command="{Binding TapCommand}"/>
</MenuBarItem>
</ContentPage.MenuBarItems>Add to MainViewModel.cs:
[RelayCommand]
async Task Tap()
{
await Shell.Current.GoToAsync(nameof(Page1));
}Add to Page1.xaml
<ContentPage.MenuBarItems>
<MenuBarItem Text="Options">
<MenuFlyoutItem Text="GoBack"
Command="{Binding GoBackCommand}"/>
<MenuFlyoutItem Text="Exit"
Command="{Binding ExitCommand}"/>
</MenuBarItem>
</ContentPage.MenuBarItems>Add to Page1ViewModel.cs
[RelayCommand]
public static void Exit()
{
System.Environment.Exit(0);
}
[RelayCommand]
async Task GoBack()
{
await Shell.Current.GoToAsync("..");
}As usual add to AppShell.xaml.cs
Routing.RegisterRoute(nameof(Page1), typeof(Page1));and add to MauiProgram.cs
builder.Services.AddSingleton<MainPage>();
builder.Services.AddSingleton<MainViewModel>();
builder.Services.AddTransient<Page1>();
builder.Services.AddTransient<Page1>();Link to public reproduction project repository
https://github.com/HimanshuBansal112/NetMauiIssue
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
I was not able test on other platforms
Affected platform versions
Windows 11(Build 22621.1344)
Did you find any workaround?
No
Relevant log output
N/AReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-menubarDesktop MenuBarItemsDesktop MenuBarItemsarea-controls-shellShell Navigation, Routes, Tabs, FlyoutShell Navigation, Routes, Tabs, Flyoutarea-navigationNavigationPageNavigationPaget/bugSomething isn't workingSomething isn't working