dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.65k stars 1.63k forks source link

Windows AppShell Title is overlaying on itself #22292

Open Eronan opened 1 week ago

Eronan commented 1 week ago

Description

image

When the NavigationStack has 2 or more items, and the ModalStack has 1 item. The AppShell will create another copy of its Window Title and attempt to overlay itself over itself causing the Title to be unreadable.

Steps to Reproduce

  1. Create a new .NET Maui App Project.
  2. Add the following code to the end of OnCounterClicked on MainPage
    if (Navigation.NavigationStack.Count > 1)
    {
    await Navigation.PushModalAsync(new MainPage());
    }
    else
    {
    await Navigation.PushAsync(new MainPage());
    }
  3. Click on the button twice, such that the NavigationStack has 2 items and the ModalStack has 1 item.
  4. image

Link to public reproduction project repository

https://github.com/Eronan/NavigationOverlayIssue

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

net8.0-windows10.0.19041.0

Did you find any workaround?

Using INavigation.PushModalAsync(new NavigationPage(new ModalPage())); instead of using shell navigation

Relevant log output

No response

github-actions[bot] commented 1 week ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Foda commented 1 week ago

Hmmm... I'm having difficulty reproducing this issue. Could you provide me a stand-alone sample with the problem?

Here's what I've tried to test with:

MainPage.cs:

public MainPage()
{
    InitializeComponent();
    this.Loaded += MainPage_Loaded;
}

private void MainPage_Loaded(object? sender, EventArgs e)
{
    this.Window.Title = "Main Page";
}

private async void Button_Clicked(object sender, EventArgs e)
{
    if (Navigation.NavigationStack.Count > 1)
    {
        await Navigation.PushModalAsync(new MainPage());
    }
    else
    {
        await Navigation.PushAsync(new MainPage());
    }
}

I've tried using both NavigationPage and Shell as the Window root page.

Eronan commented 1 week ago

https://github.com/Eronan/NavigationOverlayIssue

Created a separate repository, project, and solution file. image

Eronan commented 6 days ago

The workaround used in this Bug will also remove the duplicate heading at the top of the AppShell.

Foda commented 6 days ago

For a workaround, just remove the default Page style in Styles.xaml. That seems to be the source of the problem.