@@ -182,13 +182,14 @@ internal void UpdatePaneDisplayModeFromFlyoutBehavior(FlyoutBehavior flyoutBehav
182182 {
183183 case FlyoutBehavior . Flyout :
184184 IsPaneToggleButtonVisible = true ;
185+ var flyoutMode = FlyoutPaneDisplayMode ?? NavigationViewPaneDisplayMode . LeftMinimal ;
185186 // WinUI bug: Setting PaneDisplayMode to the same value and updating SelectedItem during navigation
186187 // causes the selection and selected item indicator to not update correctly.
187188 // Workaround: Only set PaneDisplayMode when the value actually changes.
188189 // Related: https://github.com/microsoft/microsoft-ui-xaml/issues/9812
189- if ( PaneDisplayMode != NavigationViewPaneDisplayMode . LeftMinimal )
190+ if ( PaneDisplayMode != flyoutMode )
190191 {
191- PaneDisplayMode = NavigationViewPaneDisplayMode . LeftMinimal ;
192+ PaneDisplayMode = flyoutMode ;
192193 }
193194 break ;
194195 case FlyoutBehavior . Locked :
@@ -371,6 +372,11 @@ internal static readonly DependencyProperty PaneToggleButtonWidthProperty
371372 new PropertyMetadata ( DefaultPaneToggleButtonWidth , OnPaneToggleButtonSizeChanged ) ) ;
372373 private NavigationViewPaneDisplayMode ? _pinPaneDisplayModeTo ;
373374
375+ // Stores the preferred pane display mode for FlyoutBehavior.Flyout, set by CollapseStyle on Windows.
376+ // When null, the default LeftMinimal is used. This ensures CollapseStyle.Partial (LeftCompact) survives
377+ // layout-driven FlyoutBehavior re-evaluations (e.g. size/orientation changes).
378+ internal NavigationViewPaneDisplayMode ? FlyoutPaneDisplayMode { get ; set ; }
379+
374380 internal double PaneToggleButtonWidth
375381 {
376382 get => ( double ) GetValue ( PaneToggleButtonWidthProperty ) ;
0 commit comments