Skip to content

Setting HamburgerMenu.SelectedIndex or Item cause the lost of its content #3089

@OrihuelaConde

Description

@OrihuelaConde

It could be my error but I need assistance.

What steps will reproduce this issue?

When I set HamburgerMenu.SelectedIndex it lost its content.

Expected outcome

I want to open the app and select the first item in the menu.

Environment

  • MahApps.Metro 1.5.0
  • Windows 10 1703
  • Visual Studio 2017 14.4
  • .NET Framework 4.6.1

Code

C#

public MainWindow()
{
InitializeComponent();
HamburgerMenu.SelectedIndex = 0;
MainFrame.Navigate(_ventasPage);
}

XAML

    <Controls:HamburgerMenu x:Name="HamburgerMenu" DisplayMode="CompactInline"
                            Foreground="White"
                            IsPaneOpen="False"
                            ItemTemplate="{StaticResource MenuItemTemplate}"
                            OptionsItemTemplate="{StaticResource MenuItemTemplate}"
                            PaneBackground="#FF444444"
                            ItemClick="HamburgerMenu_ItemClick">
        <Controls:HamburgerMenu.ItemsSource>
            <Controls:HamburgerMenuItemCollection>
                <Controls:HamburgerMenuIconItem Icon="{iconPacks:PackIconModern Tag, Width=25, Height=25}" Label="Ventas" Tag="Ventas"/>
                <Controls:HamburgerMenuIconItem Icon="{iconPacks:PackIconModern Settings, Width=25, Height=25}" Label="Administración" Tag="Administracion"/>
                <Controls:HamburgerMenuIconItem Icon="{iconPacks:PackIconModern SocialDropbox, Width=25, Height=25}" Label="Stock" Tag="Stock"/>
            </Controls:HamburgerMenuItemCollection>
        </Controls:HamburgerMenu.ItemsSource>

        <!--  Content  -->
        <Controls:HamburgerMenu.Content>
            <Grid>
                <Frame x:Name="MainFrame" NavigationUIVisibility="Hidden" Navigating="MainFrame_Navigating" LoadCompleted="MainFrame_LoadCompleted"/>
                <Controls:ProgressRing x:Name="Progreso"/>
            </Grid>
        </Controls:HamburgerMenu.Content>
    </Controls:HamburgerMenu>
</Grid>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions