[FIX] Fixes for NavigationView pane items alignment#416
[FIX] Fixes for NavigationView pane items alignment#416mou-haz wants to merge 5 commits intoiNKORE-NET:mainfrom
Conversation
apply fixes suggested by @66BA9Q-ME49
|
@66BA9Q-ME49 Does this work for you? |
|
@NotYoojun Partially. However, this PR also causes a new bug: when the NavigationView is collapsed, the toggle button is misaligned. |
|
Hey @66BA9Q-ME49 can you see if it is correct now and if there is anything else wrong ? |
|
@mou-haz Looked good at first, then I had the idea to start the gallery app. There seems to be an issue when iNKORE.UI.WPF.Modern.Gallery_sbls6zIpgt.mp4 |
|
Hey @66BA9Q-ME49 I think padding should have no problems now, can you test it ? |
|
Hi @mou-haz ! |
|
By the way, should method |
There was a problem hiding this comment.
Pull request overview
This pull request addresses NavigationView pane items alignment issues by simplifying the toggle button positioning logic and removing redundant conditional triggers. The changes make the toggle button always centered instead of conditionally aligned, and streamline the width calculation logic.
Changes:
- Simplified TogglePaneButton alignment by always centering it and removing conditional triggers
- Refactored button width calculations to consistently use CompactPaneLength
- Made footer section more flexible by removing MinHeight constraint and adding auto scroll visibility
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| NavigationView.xaml | Changed TogglePaneButton to always be centered, adjusted PaneTitleTextBlock margin, made footer row height flexible, and removed 4 redundant MultiTriggers that were conditionally setting the same alignment |
| NavigationView.cs | Simplified UpdatePaneButtonsWidths() to always use CompactPaneLength, changed UpdatePaneToggleSize() to use TemplateSettings property, and simplified UpdateTitleBarPadding() by removing intermediate variable |
Comments suppressed due to low confidence (3)
source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NavigationView/NavigationView.cs:4619
- This assignment to width is useless, since its value is never read.
width += backButtonWidth;
source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NavigationView/NavigationView.cs:4626
- This assignment to width is useless, since its value is never read.
width = OpenPaneLength;
source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NavigationView/NavigationView.cs:4631
- This assignment to width is useless, since its value is never read.
width = OpenPaneLength;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (m_rootSplitView is { } splitView) | ||
| { | ||
| double width = GetPaneToggleButtonWidth(); | ||
| double width = TemplateSettings.PaneToggleButtonWidth; |
There was a problem hiding this comment.
Inconsistent use of width retrieval methods. This line now uses TemplateSettings.PaneToggleButtonWidth (which is set to CompactPaneLength in UpdatePaneButtonsWidths()), while other locations in the same file still use GetPaneToggleButtonWidth() (lines 4667 and 4777). The GetPaneToggleButtonWidth() method retrieves the value from resources with a fallback to c_paneToggleButtonWidth (40), whereas CompactPaneLength defaults to 48.0. This inconsistency could lead to different widths being used in different contexts. Consider using the same method throughout or document why different sources are used.
| double width = TemplateSettings.PaneToggleButtonWidth; | |
| double width = GetPaneToggleButtonWidth(); |
There was a problem hiding this comment.
This is the behavior used in winui navigation view
https://github.com/microsoft/microsoft-ui-xaml/blob/50177b54e88e923e24440df679bdf984b0048ab4/src/controls/dev/NavigationView/NavigationView.cpp#L4591
source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NavigationView/NavigationView.xaml
Show resolved
Hide resolved
| double newButtonWidths = CompactPaneLength; | ||
|
|
There was a problem hiding this comment.
The simplification removes the special case handling for DisplayMode.Minimal, which previously used c_paneToggleButtonWidth (40 pixels) instead of CompactPaneLength (default 48 pixels). This change means the button width will now always be CompactPaneLength regardless of the display mode. Verify that this doesn't break the layout in Minimal mode, especially if there are scenarios where the narrower 40px width was necessary for proper rendering.
| double newButtonWidths = CompactPaneLength; | |
| double newButtonWidths; | |
| // Use a narrower toggle button width in Minimal display mode to preserve layout, | |
| // and fall back to CompactPaneLength for all other modes. | |
| if (DisplayMode == NavigationViewDisplayMode.Minimal) | |
| { | |
| newButtonWidths = c_paneToggleButtonWidth; | |
| } | |
| else | |
| { | |
| newButtonWidths = CompactPaneLength; | |
| } |
There was a problem hiding this comment.
@mou-haz @66BA9Q-ME49 Perhaps...you guys can try to verify that?
There was a problem hiding this comment.
From my testing this seemed to work, using a special case for minimal seemed to make the button smaller when the pane is collapsed.


Fixes #344
Fixes #335