-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixed NavigationPage TitleBar visibility issue when set to the parent page #25000
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
public void NavigationBarVisibility() | ||
{ | ||
App.WaitForElement("label"); | ||
VerifyScreenshot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Triggered the build, it should generate the reference snapshot for this test.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
4c66ea9
to
f150abb
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
I think this one is going to require some additional design decisions. For example, if you nest the contentpage inside another layer <TabbedPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.MainPage"
xmlns:local="clr-namespace:Maui.Controls.Sample"
NavigationPage.HasNavigationBar="False"
>
<TabbedPage>
<ContentPage Title="Title 1"></ContentPage>
</TabbedPage>
<TabbedPage>
<ContentPage Title="Title 2"></ContentPage>
</TabbedPage>
</TabbedPage> This fix doesn't really work. Generally, with any extension properties it has to be applied to the Plus we'd want to apply this logic to TabbedPage extension properties as well. One way users can get around this is by setting a resource on the <TabbedPage.Resources>
<Style TargetType="ContentPage">
<Setter Property="NavigationPage.HasNavigationBar" Value="False" />
</Style>
</TabbedPage.Resources> I'm going to close this one for now. We can look at making all of these attached properties inheritable at a later point in time |
Root Cause
The NavigationBar stayed visible because only the current page's HasNavigationBar property was checked, ignoring the parent
NavigationPage's setting when it was false.
Description of Change
The fix now checks both the parent NavigationPage and current page’s HasNavigationBar property. This ensures the NavigationBar is hidden when either the parent or current page has HasNavigationBar set to false.
Issues Fixed
Fixes #13807
Fixes #16816
Tested the behaviour in the following platforms
Screenshots
Before
After