Open HimanshuBansal112 opened 1 year ago
Hi @HimanshuBansal112. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I tested in .net 8, it does not work there as well. I have made a repo at https://github.com/HimanshuBansal112/NetMauiIssue It also has issue after we go to any page from menu bar then come back and then try to go again, it does not work.
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Seems like the flyout items' binding context is getting lost during the navigation process. For me I have 'fixed' the issue like this:
protected override void OnAppearing()
{
base.OnAppearing();
foreach (var item in MenuBarItems)
{
item.BindingContext = BindingContext;
}
}
I have the same issue and @vrishe's solution fixes it. If we're not supposed to do things like this (since this is "under consideration"?) how are we supposed to do it??
I have the same issue and @vrishe's solution fixes it. If we're not supposed to do things like this (since this is "under consideration"?) how are we supposed to do it??
What vrishe proposed is a workaround, not a fix. Fix mean it should have work correctly as intended, no work around needed.
Seems like the flyout items' binding context is getting lost during the navigation process. For me I have 'fixed' the issue like this:
protected override void OnAppearing() { base.OnAppearing(); foreach (var item in MenuBarItems) { item.BindingContext = BindingContext; } }
Works like charm thank you Brother
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:
Add to MainViewModel.cs:
Add to Page1.xaml
Add to Page1ViewModel.cs
As usual add to AppShell.xaml.cs
and add to MauiProgram.cs
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