
The button content itself uses to draw the icons. Also they set WindowChrome.IsHitTestVisibleInChrome to True, which allows them to pick up clicks even though they are in the 32px caption area we set up earlier. They have triggers to change the background color on mouse over (and the foreground color in the case of the Close button).

These are buttons with stripped-down control templates to remove a lot of the extra gunk. The actual buttons use TitleBarButtonStyle and TitleBarCloseButtonStyle: That allows the user to better tell if the window has focus or not. The title text has a trigger to change its color based on the “Active” state of the window.

But it’s certainly something you could add.
#Customize title bar windows 10 code#
I chose not to implement the special drop-down menu that comes with the standard title bar since it’s not often used and other major apps like Visual Studio Code don’t bother with it. The ResizeBorderThickness allows the standard window resize logic to work, so we don’t need to reimplement that either. This means that click to drag works, along with double clicking to maximize/restore, shaking to minimize other windows, etc. The CaptionHeight tells the OS to treat the top 32px of your window as if it was a title bar. Next, allocate space for your title bar in your UI. That will remove the built-in title bar and allow you to do everything on your own. Building the UIįirst, set WindowStyle=”None” on your Window.
#Customize title bar windows 10 full#
It’s one little thing you lose when going with a full custom title bar, but it should be worth it by allowing full cohesive theming. I am choosing not to attempt to match the style for old versions of Windows, as I don’t think that would be a great time investment.

This will keep my UI consistent with the rest of Windows. However the actual implementation is kind of tricky, since it is now your job to provide a bunch of features that you used to get for free. There are several good reasons for wanting custom window chrome in WPF, such as fitting in additional UI or implementing a Dark theme.
