Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HamburgerMenu ItemInvoked doesn't fire automatically #3436

Closed
furqansafdar opened this issue Jan 24, 2019 · 5 comments · Fixed by #3444
Closed

HamburgerMenu ItemInvoked doesn't fire automatically #3436

furqansafdar opened this issue Jan 24, 2019 · 5 comments · Fixed by #3444
Labels
Milestone

Comments

@furqansafdar
Copy link

furqansafdar commented Jan 24, 2019

Problem
I have found a small glitch or bug you may say in HamburgerMenu when using it with PRISM library to load dynamic modules.

I have a navigation pane on left and content pane on right (as shown in the screenshot below). Every module is loaded with navigation item and upon clicking the item, the corresponding content is loaded in the right pane. I have set the HamburgerMenu's SelectedIndex to 0, so that once the loading it completed the first item is selected and its corresponding content is loaded. The logic of loading the content is residing in HamburgerMenu's ItemInvoked event but it is not fired automatically for the selected item. Hence the following layout is produced.

hamburgerissue

Now when i click the first item again, event fires and content is loaded. I think this issue can be solved if ItemInvoked fires for selected item automatically.

private void HamburgerMenu_OnItemInvoked(object sender, HamburgerMenuItemInvokedEventArgs e)
{            
    var option = (HamburgerMenuGlyphItem)e.InvokedItem;
    var viewName = (string)option.Tag;
    var region = _regionManager.Regions[RegionNames.TabRegion];
    region?.RequestNavigate(viewName);
}

Environment

  • MahApps.Metro version 1.6.5
  • OS: Win10 1803
  • Visual Studio 2017/2019
  • .NET Framework 4.6.1
@punker76 punker76 added the Bug label Jan 28, 2019
@punker76 punker76 added this to the 2.0.0 milestone Jan 28, 2019
@punker76
Copy link
Member

@furqansafdar Can you create for this issue a sample? Thx

@punker76
Copy link
Member

@furqansafdar Or did you mean, that the OnItemInvoked will not be fired for the first time load of the control?

@furqansafdar
Copy link
Author

@punker76 Yes, i think OnItemInvoked should fire after loading because essentially it hold the logic to load the corresponding content.

@furqansafdar
Copy link
Author

furqansafdar commented Aug 22, 2023

While I am checking this issue after a long time, but still in version 2.4.10 of MahApps.Metro, it is still existing. No auto invocation of OnItemInvoked when SelectedIndex is set to 0. Am I missing something?

@timunie
Copy link
Collaborator

timunie commented Aug 22, 2023

@furqansafdar must probably be a different issue. Please use discussions and show your xaml and ViewModel involved. Maybe there is something missing...

Note: In general, do not answer closed issues. There's a high chance your comment gets lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants