Problem: the sidebar doesn't close after I navigate to another page.
What I've tried: adding a OnClick=""
event to the <MudNavLink>
to close the sidebar, however if I do that it will override the href
(meaning it closes the sidebar, but does not navigate to another page).
<MudLayout>
<MudAppBar Elevation="3">
<MudIconButton Style=" margin: 0; position: absolute; top: 50%; -ms-transform: translateY(-50%); transform: translateY(-50%); " Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="ToggleSidebar" />
</MudAppBar>
<MudDrawer Open="_sidebarOpen" Elevation="1">
<MudNavMenu>
<MudNavLink Href="/index" Match="NavLinkMatch.All" Icon="@Icons.Filled.Home">Home</MudNavLink>
...
</MudNavMenu>
</MudDrawer>
</MudLayout>
Added Variant="DrawerVariant.Temporary"
:
...
<MudDrawer @bind-Open="_sidebarOpen" Elevation="1" Variant="DrawerVariant.Temporary">
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With