WinUI-Gallery icon indicating copy to clipboard operation
WinUI-Gallery copied to clipboard

Title Bar Invisible when adding Frame

Open ashwith2427 opened this issue 1 year ago • 3 comments

Issue type

sample request

Which version of the app?

WinUI 3 Gallery

Description

When I add this code to my App.xaml `Frame rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // Navigate to the first page, configuring the new page // by passing required information as a navigation parameter rootFrame.Navigate(typeof(LoginPage), args.Arguments);

// Place the frame in the current Window m_window.Content = rootFrame;`

The title Bar is vanishing and not visible on the page.

When i remove this part the title is bar is set but i want different frames and titlebar.

Screenshots

image

Windows version

Insider Build (xxxxx)

Additional context

No response

ashwith2427 avatar Jan 26 '24 11:01 ashwith2427

Hi, unfortunately I'm unable to reproduce this issue. Can you share the code of your LoginPage? I'm inclined to say that there might be the issue.

marcelwgn avatar Mar 21 '24 21:03 marcelwgn

Is there any update with this? I am experiencing this exact issue.

I am using a fully custom titlebar per: https://learn.microsoft.com/en-us/windows/apps/develop/title-bar#full-customization-example.

When I add frame navigation to my OnLaunched event in the App.xaml.cs file, the title bar is removed. (per https://learn.microsoft.com/en-us/windows/apps/design/basics/navigate-between-two-pages?tabs=wasdk)

    protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
    {
        m_window = new MainWindow();

        // Create a Frame to act as the navigation context and navigate to the first page
        Frame rootFrame = new Frame();
        rootFrame.NavigationFailed += OnNavigationFailed;
        // Navigate to the first page, configuring the new page
        // by passing required information as a navigation parameter
        rootFrame.Navigate(typeof(MainPage), args.Arguments);

        // Place the frame in the current Window
        m_window.Content = rootFrame;
        // Ensure the MainWindow is active
        m_window.Activate();
    }

By omitting "m_window.Content = rootFrame;", my custom titlebar is left in tact, however, obviously my application will now no longer navigate to the desired page.

i8jtb avatar May 09 '24 06:05 i8jtb

Is there any update with this? I am experiencing this exact issue.

I am using a fully custom titlebar per: https://learn.microsoft.com/en-us/windows/apps/develop/title-bar#full-customization-example.

When I add frame navigation to my OnLaunched event in the App.xaml.cs file, the title bar is removed. (per https://learn.microsoft.com/en-us/windows/apps/design/basics/navigate-between-two-pages?tabs=wasdk)

    protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
    {
        m_window = new MainWindow();

        // Create a Frame to act as the navigation context and navigate to the first page
        Frame rootFrame = new Frame();
        rootFrame.NavigationFailed += OnNavigationFailed;
        // Navigate to the first page, configuring the new page
        // by passing required information as a navigation parameter
        rootFrame.Navigate(typeof(MainPage), args.Arguments);

        // Place the frame in the current Window
        m_window.Content = rootFrame;
        // Ensure the MainWindow is active
        m_window.Activate();
    }

By omitting "m_window.Content = rootFrame;", my custom titlebar is left in tact, however, obviously my application will now no longer navigate to the desired page.

Can you attach a repro app? Thanks in advance!

karkarl avatar May 16 '24 18:05 karkarl