Skip to content

Conversation

AndrewKeepCoding
Copy link
Contributor

@AndrewKeepCoding AndrewKeepCoding commented Sep 17, 2025

Description

This PR fixes the app title bar gap beneath the caption buttons.

Motivation and Context

Provides a cleaner, more professional look.

How Has This Been Tested?

Ran the app and confirmed the change under different DPI, resolutions, and switches between them on Win 11.

Screenshots (if appropriate):

Current:

image

New:

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

</Window.SystemBackdrop>
<Grid x:Name="RootGrid" Loaded="RootGrid_Loaded">
<Grid.Resources>
<x:Double x:Key="TitleBarExpandedHeight">46</x:Double>

Choose a reason for hiding this comment

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

Why was 46 chosen as the value for TitleBarExpandedHeight?
Is this value derived via observation? If yes, then a hardcoded workaround might break under different conditions (e.g., DPI scaling, theme changes, or different Windows versions, resolution settings)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Saharsh979! Thanks for pointing that out. I should’ve mentioned that I tested the fix under different DPI, resolutions, and while switching between them on Win 11.
That said, the current title bar already relies on some hardcoded width/height values, so I followed the same approach here. I couldn’t find a more flexible way to address the gap, but I’m definitely open to better alternatives if you have suggestions.

@Saharsh979
Copy link

/azp run

Copy link
Contributor

@Zakariathr22 Zakariathr22 left a comment

Choose a reason for hiding this comment

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

When the window is maximized, there will be a 1px overlap between the title bar buttons and the NavigationView.
Image
I don’t recommend modifying the TitleBarExpandedHeight resource. Instead, adjust the NavigationView’s padding between "0, -1, 0, 0" and "0, -2, 0, 0" depending on whether the window is maximized or restored.

Added `WindowPresenter` and `CurrentWindowState` properties to track and manage the window's presentation state. Updated the `MainWindow` constructor to initialize these properties and adjust the `NavigationView` margin dynamically. Introduced the `AdjustNavigationViewMargin` method to handle margin adjustments when the window state changes, ensuring proper alignment of the `NavigationView` with the caption buttons.
@AndrewKeepCoding
Copy link
Contributor Author

@Zakariathr22 Great catch! Thanks! I followed your suggestion (I guess you meant Margin instead of Padding).

@Zakariathr22
Copy link
Contributor

I guess you meant Margin instead of Padding

Exactly!

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.

3 participants