Skip to content

[FIX] Fixes for NavigationView pane items alignment#416

Open
mou-haz wants to merge 5 commits intoiNKORE-NET:mainfrom
mou-haz:NavViewPaneAlignment
Open

[FIX] Fixes for NavigationView pane items alignment#416
mou-haz wants to merge 5 commits intoiNKORE-NET:mainfrom
mou-haz:NavViewPaneAlignment

Conversation

@mou-haz
Copy link
Contributor

@mou-haz mou-haz commented Jan 8, 2026

Fixes #344
Fixes #335

@NotYoojun NotYoojun requested review from NotYoojun and Copilot and removed request for Copilot January 9, 2026 06:17
@NotYoojun
Copy link
Member

@66BA9Q-ME49 Does this work for you?

@66BA9Q-ME49
Copy link

66BA9Q-ME49 commented Jan 13, 2026

@NotYoojun Partially.
The bugs I reported in the two issues are fixed:
image

However, this PR also causes a new bug: when the NavigationView is collapsed, the toggle button is misaligned.
image

@mou-haz
Copy link
Contributor Author

mou-haz commented Jan 14, 2026

Hey @66BA9Q-ME49 can you see if it is correct now and if there is anything else wrong ?

@66BA9Q-ME49
Copy link

@mou-haz Looked good at first, then I had the idea to start the gallery app.

There seems to be an issue when PaneTitle (the text of the toggle button) is empty.

iNKORE.UI.WPF.Modern.Gallery_sbls6zIpgt.mp4

@mou-haz
Copy link
Contributor Author

mou-haz commented Jan 15, 2026

Hey @66BA9Q-ME49 I think padding should have no problems now, can you test it ?

@66BA9Q-ME49
Copy link

Hi @mou-haz !
Looks good to me, I didn't notice any other issue.

@NotYoojun
Copy link
Member

By the way, should method GetPaneToggleButtonWidth() remain used in other places or are you intended to replace it all?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
double width = TemplateSettings.PaneToggleButtonWidth;
double width = GetPaneToggleButtonWidth();

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1918 to 1919
double newButtonWidths = CompactPaneLength;

Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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;
}

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mou-haz @66BA9Q-ME49 Perhaps...you guys can try to verify that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my testing this seemed to work, using a special case for minimal seemed to make the button smaller when the pane is collapsed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NavigationView Pane Toggle Button Misaligned When Expanded and IsBackButtonVisible="Collapsed" Large empty space below NavigationView.PaneFooter

3 participants