diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldHideHeaderWhenTitleEmpty.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldHideHeaderWhenTitleEmpty.png index 87ca549b7989..1388b4281fd5 100644 Binary files a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldHideHeaderWhenTitleEmpty.png and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldHideHeaderWhenTitleEmpty.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldShowHeaderWhenTitleNotEmpty.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldShowHeaderWhenTitleNotEmpty.png new file mode 100644 index 000000000000..1129ad67f6bf Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/ShouldShowHeaderWhenTitleNotEmpty.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ModalPageBackgroundShouldBeTransparent.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ModalPageBackgroundShouldBeTransparent.png index c6abfec6960e..9005f93ceea4 100644 Binary files a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ModalPageBackgroundShouldBeTransparent.png and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ModalPageBackgroundShouldBeTransparent.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldHideHeaderWhenTitleEmpty.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldHideHeaderWhenTitleEmpty.png index 322dfcff2aa9..2f8068d77c23 100644 Binary files a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldHideHeaderWhenTitleEmpty.png and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldHideHeaderWhenTitleEmpty.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldShowHeaderWhenTitleNotEmpty.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldShowHeaderWhenTitleNotEmpty.png new file mode 100644 index 000000000000..bafc9376b6ce Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ShouldShowHeaderWhenTitleNotEmpty.png differ diff --git a/src/Core/src/Platform/Windows/RootNavigationView.cs b/src/Core/src/Platform/Windows/RootNavigationView.cs index c43ccac44a68..2fd6397b0f3b 100644 --- a/src/Core/src/Platform/Windows/RootNavigationView.cs +++ b/src/Core/src/Platform/Windows/RootNavigationView.cs @@ -68,6 +68,17 @@ internal Size FlyoutPaneSize void PaneDisplayModeChanged(DependencyObject sender, DependencyProperty dp) { + // AlwaysShowHeader must be false only in LeftMinimal mode (Shell flyout) so that + // CollapseEmptyHeader() can remove the header space when title/items are empty. + // All other modes (e.g. Left / FlyoutBehavior.Locked) keep AlwaysShowHeader=true + // so the header area remains visible regardless of content — restoring the + // original NavigationView behaviour and preventing the Issue2740 regression. + // Note: Top mode (TabbedPage) is safe with AlwaysShowHeader=true because + // UpdateToolbarPlacement() sets Header=null there, and WinUI's HeaderContent + // (a ContentControl) auto-collapses to zero height when its content is null. + // Additionally, UpdateHeaderPropertyBinding() binds HeaderContent.Visibility + // directly to Toolbar.Visibility, bypassing AlwaysShowHeader entirely. + AlwaysShowHeader = PaneDisplayMode != NavigationViewPaneDisplayMode.LeftMinimal; UpdateToolbarPlacement(); UpdatePaneContentGridMargin(); UpdateHeaderVisibility();