Create shell with different control than hamburger menu

131 views Asked by At

I tried to create shell with Page.BottomAppBar. The result is the bar is visible but content of the MainPage is not, only black screen is shown.

public override Task OnInitializeAsync(IActivatedEventArgs args)
    {
        Window.Current.Content = new Views.ShellNavBar();
        return Task.CompletedTask;
    }

This is ShellNavBar Page:

 <Page
    /.../

    <Page.BottomAppBar>
        <CommandBar>
            <AppBarSeparator/>
            <AppBarButton Icon="Add" Label="Add" Click="AppBarAddButton_Click" />
            <AppBarButton Icon="Home" Label="Home" Click="AppBarHomeButton_Click" />

            <CommandBar.Content>
                <TextBlock x:Name="HeadText" Text="PlaceHolder" Margin="12,14"/>
            </CommandBar.Content>
        </CommandBar>
    </Page.BottomAppBar>
</Page>

Can someone guide me where I am doing mistake?

1

There are 1 answers

0
Jerry Nixon On

Well, I added your code to the template to see if it would work and it did. Doesn't even occlude any of the Hamburger Menu. I am not sure what the problem you have is, I think you might have a typo or something because your approach is fine.

Here's my app.xaml.cs code:

public override UIElement CreateRootElement(IActivatedEventArgs e)
{
    var service = NavigationServiceFactory(BackButton.Attach, ExistingContent.Exclude);
    return new ModalDialog(new Views.Shell(service), ModalContent = new Views.Busy());
}

public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
    await NavigationService.NavigateAsync(typeof(Views.MainPage));
}

enter image description here

Thanks for using Template 10.