79135300

Date: 2024-10-28 22:44:13
Score: 0.5
Natty:
Report link

Qiang thank you very much for the brilliant idea. Below is the actual code that worked in my solution.

    @using MudBlazorTraining.Components.Layouts
@inject NavigationManager Navigation

<Router AppAssembly="typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="routeData" DefaultLayout="GetLayoutType()" />
        <FocusOnNavigate RouteData="routeData" Selector="h1" />
    </Found>
</Router>

@code {

    private Type GetLayoutType()
    {
        if (Navigation.Uri.EndsWith("Tab"))
        {
            return typeof(TabLayout);
        }
        else
        {
            return typeof(MainLayout);
        }
    }
}
Reasons:
  • Blacklisted phrase (0.5): thank you
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Axium7