@@ -19,6 +19,7 @@ public abstract partial class AbstractPackagesPage : UserControl,
1919{
2020 public PackagesPageViewModel ViewModel => ( PackagesPageViewModel ) DataContext ! ;
2121 private ContextMenu ? _contextMenu ;
22+ private double _savedFilterPaneWidth = 220 ;
2223
2324 protected AbstractPackagesPage ( PackagesPageData data )
2425 {
@@ -72,6 +73,23 @@ or nameof(PackagesPageViewModel.SortAscending))
7273 // redirect focus + the typed character to the global search box.
7374 PackageList . TextInput += PackageList_TextInput ;
7475
76+ // Close the filter pane when the splitter is dragged below the minimum width.
77+ // Observe ColumnDefinition.Width so the snap fires during the drag, not just
78+ // on pointer-release (pointer capture prevents PointerReleased on the splitter).
79+ FilteringPanel . ColumnDefinitions [ 0 ]
80+ . GetObservable ( ColumnDefinition . WidthProperty )
81+ . Subscribe ( width =>
82+ {
83+ if ( ! ViewModel . IsFilterPaneOpen ) return ;
84+ if ( width . IsAbsolute && width . Value >= 100 )
85+ _savedFilterPaneWidth = width . Value ; // remember last good drag width
86+ else if ( width . IsAbsolute && width . Value < 100 )
87+ {
88+ _savedFilterPaneWidth = 220 ; // reset to default on snap-close
89+ ViewModel . IsFilterPaneOpen = false ;
90+ }
91+ } ) ;
92+
7593 // Wire context menu (built by subclass)
7694 _contextMenu = GenerateContextMenu ( ) ;
7795 if ( _contextMenu is not null )
@@ -83,6 +101,9 @@ or nameof(PackagesPageViewModel.SortAscending))
83101 if ( pkg is not null ) WhenShowingContextMenu ( pkg ) ;
84102 } ;
85103 }
104+
105+ // Apply the initial filter-pane state (AXAML defaults to 220px open)
106+ UpdateFilterPaneColumn ( ViewModel . IsFilterPaneOpen ) ;
86107 }
87108
88109 // ─── UI-only: focus the package list ─────────────────────────────────────
@@ -259,19 +280,16 @@ private void PackageList_TextInput(object? sender, TextInputEventArgs e)
259280 }
260281
261282 // ─── Filter pane column width management ─────────────────────────────────
262- private GridLength _savedFilterPaneWidth = new GridLength ( 220 ) ;
263-
264283 private void UpdateFilterPaneColumn ( bool open )
265284 {
266285 if ( FilteringPanel . ColumnDefinitions . Count < 2 ) return ;
267286 if ( open )
268287 {
269- FilteringPanel . ColumnDefinitions [ 0 ] . Width = _savedFilterPaneWidth ;
288+ FilteringPanel . ColumnDefinitions [ 0 ] . Width = new GridLength ( _savedFilterPaneWidth ) ;
270289 FilteringPanel . ColumnDefinitions [ 1 ] . Width = new GridLength ( 4 ) ;
271290 }
272291 else
273292 {
274- _savedFilterPaneWidth = FilteringPanel . ColumnDefinitions [ 0 ] . Width ;
275293 FilteringPanel . ColumnDefinitions [ 0 ] . Width = new GridLength ( 0 ) ;
276294 FilteringPanel . ColumnDefinitions [ 1 ] . Width = new GridLength ( 0 ) ;
277295 }
0 commit comments