Repository navigation
feat(controls): Add GridSplitter support to LeftNavigationViewTemplate - #1603
Koichi-Kobayashi wants to merge 3 commits into
Conversation
|
This destroys the navigation animations and makes the search box collapse extremely ugly. |
|
Sorry about that.
2026-01-12_22h25_59.mp4 |
- Add IsGridSplitterEnabled dependency property to enable/disable GridSplitter - Implement GridSplitter between navigation pane and content area - Ensure navigation pane width resizes with GridSplitter while maintaining left alignment - Manage PaneColumn width through code-behind using OpenPaneLength as initial width - Remove ColumnDefinition width animations from VisualStateManager to prevent exceptions - Add proper event handler cleanup and thread-safe updates using Dispatcher - Handle GridLength safely with IsAbsolute checks before accessing Value property - Default value is false to maintain backward compatibility
- Add UpdatePaneColumnWidthForToggle method to handle pane open/close events - Call UpdatePaneColumnWidthForToggle from OnPaneOpened and OnPaneClosed - Ensure PaneColumn width updates correctly when toggle button is clicked - Preserve manually resized width when toggling pane open/closed - Fix issue where pane width was not updating when using GridSplitter
PR lepoco#1603 replaced the animated PaneGrid width with immediate column width updates. This made pane transitions snap while the search box continued its existing fade and visibility transitions, producing an uneven collapse. Restore pane and search transition coordination: - Restore PaneGrid.Width DoubleAnimations in the existing visual states, retaining the 160 ms duration and 0.4 acceleration ratio. - Configure animation endpoints from the current width and the stored resize target so resized panes animate back to their selected width. - Start interrupted width and opacity transitions from their current values to support rapid repeated opening and closing. - Keep the existing search visibility transitions and compact pane margins. Preserve GridSplitter behavior and binding safety: - Track the resized pane width separately from OpenPaneLength and bind the pane's base width to a private dependency property. - Let the splitter control column widths during a drag, then return the pane column to Auto sizing so visual states can animate PaneGrid.Width. - Preserve resized widths across pane toggles, splitter enablement changes, and template replacement; honor explicit OpenPaneLength changes. - Handle canceled drags and keyboard resizing, and disable resizing during pane transitions or unsupported display modes. - Detach resize and storyboard handlers before template reapplication and clone storyboards before configuring instance-specific animation targets. - Remove deferred width updates, property descriptors, and blanket exception suppression from the previous resize implementation. Center the splitter interaction area on the visible content border: - Translate the 4 DIP hit area to the center of the 1 DIP border, accounting for FrameMargin.Left without changing the resize columns or pane layout. - Place the splitter above the content border so both sides of the centered hit area receive mouse input. Add regression coverage for pane/search transitions, interrupted toggles, width restoration, binding preservation, template replacement, other display modes, canceled drags, keyboard resizing, and centered hit testing at multiple pane widths and frame margins. Add Gallery integration coverage using actual mouse drags to expand and shrink the pane and verify width restoration after closing and reopening it. Validation: - Debug solution build passed with existing dependency/analyzer warnings. - All 21 unit tests passed. - Both Gallery mouse-drag integration cases passed. - git diff --check passed. Visual animation smoothness, manual interaction feel, and additional DPI, theme, and window-resize combinations still require manual verification.
ff91277 to
2e958dc
Compare
|
@Nuklon The previous implementation changed the pane column width immediately while the search box continued its fade and visibility transitions. The updated implementation restores PaneGrid.Width animations through the existing VisualStateManager, retaining the original 160 ms duration and acceleration ratio. The resized width is stored separately from OpenPaneLength, so closing and reopening the pane restores the user's selected width without replacing the OpenPaneLength binding. Interrupted width and opacity transitions start from their current values to support rapid toggling. I also centered the splitter's hit area on the visible content border and ensured that both sides receive mouse input. Validation:
The automated tests cover animation configuration, width restoration, binding preservation, template replacement, keyboard resizing, and hit testing. The branch has also been rebased onto upstream/main. |
Pull request type
What is the current behavior?
The width of the navigation panel can be specified using OpenPaneLength,
but it cannot be resized dynamically.
I came up with a better approach than my pull request #1519.
What is the new behavior?
The GridSplitter allows users to manually resize the navigation pane width,
and the navigation menu automatically adjusts its width accordingly while
staying left-aligned. The initial width is controlled by the OpenPaneLength property.
Other information
2025-12-14_01h06_52.mp4