Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows AppShell Title is overlaying on itself #22292

Open
Eronan opened this issue May 8, 2024 · 6 comments
Open

Windows AppShell Title is overlaying on itself #22292

Eronan opened this issue May 8, 2024 · 6 comments
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-controls-titleview TitleView platform/windows 🪟 t/bug Something isn't working
Milestone

Comments

@Eronan
Copy link

Eronan commented May 8, 2024

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());
}
  1. Click on the button twice, such that the NavigationStack has 2 items and the ModalStack has 1 item.
  2. 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

@Eronan Eronan added the t/bug Something isn't working label May 8, 2024
Copy link
Contributor

github-actions bot commented May 8, 2024

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.

@PureWeen PureWeen added platform/windows 🪟 area-controls-shell Shell Navigation, Routes, Tabs, Flyout legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-titleview TitleView labels May 8, 2024
@PureWeen PureWeen added this to the Backlog milestone May 8, 2024
@Foda
Copy link
Member

Foda commented May 8, 2024

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
Copy link
Author

Eronan commented May 9, 2024

https://github.com/Eronan/NavigationOverlayIssue

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

@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@Eronan
Copy link
Author

Eronan commented May 13, 2024

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

@Foda
Copy link
Member

Foda commented May 13, 2024

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

@sasharp
Copy link

sasharp commented Sep 24, 2024

It may happen, if there is Flyout. For this case workaround to hide it:

AppShell.xaml

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
...
Navigated="shell_Navigated"
...

AppShell.xaml.cs

    private void shell_Navigated(object sender, ShellNavigatedEventArgs e) {
        if (GetPresentationMode(CurrentPage) == PresentationMode.Modal ||
            GetPresentationMode(CurrentPage) == PresentationMode.ModalAnimated ||
            GetPresentationMode(CurrentPage) == PresentationMode.ModalNotAnimated)
        {
            SetFlyoutBehavior(this, FlyoutBehavior.Disabled);
        }
        else
        {
            SetFlyoutBehavior(this, FlyoutBehavior.Flyout);
        }
    }

You wont see overlapping if you have the same Title on pages. More difficult it is if you have multiple modals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-controls-titleview TitleView platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants