Microsoft-ui-xaml: Question: Why is TitleBar customisation not coming to Win32 WinUI 3 Windows?

Created on 17 Mar 2020  路  12Comments  路  Source: microsoft/microsoft-ui-xaml

Regarding the API Spec being proposed here Window_and_Application_API_Spec.md.
Could you provide some information as to why the ability to customise or replace the TitleBar and Window Controls is not being ported/enabled for Win32 created Windows? I understand this is part of the CoreWindow which is reserved for UWP applications, but Win32 should typically be a superset of UWP features, but with more customisation.

I realise there is a way to access the Hwnd underlying for the window, but it could be beneficial to wrap up some of this ability in a simple to use API, accessible from XAML and code - which does not require such deep access to window drawing - in a way that enables the same scenarios that CoreWindow enables.

https://github.com/thomasclaudiushuber/microsoft-ui-xaml-specs/blob/patch-1/active/Win32/Window_and_Application_API_Spec.md#windowsettitlebaruielement-method

Visual examples:

image
image
image

_with NavigationView Extended into TitleBar area_


image

image

_customised but not Extended into TitleBar area_


image

image

_without extending into TitleBar_

question team-CompInput

Most helpful comment

Could WinUI / Reunion include a TitleBar xaml control, with built in behaviours and the ability to re-colour and theme/re-template?

All 12 comments

There are other proposed APIs proposed that will be part of the future phases.

Titlebar customization might be part of the future APIs. If I recall correctly, the team stated that it is having in mind the UWP-style titlebar customization APIs for future WinUI support: https://github.com/microsoft/microsoft-ui-xaml/issues/1323#issuecomment-542785441

That might or might not mean support for WinUI desktop.

I asked a similar question in the spec: https://github.com/microsoft/microsoft-ui-xaml-specs/pull/71#discussion_r393133552

Then the questions are:
Will the TitleBar API come in the future?
Will it be there for WinUI 3.0 release?
If its not coming, why was that decision made?
Will there be code guidence to achieve the same effect of colourising the window controls, extending Acrylic into the titlebar area, and using custom Xaml elements as the grabbable title area - using HWND access.

@marb2000 @YuliKl as FYI

I wish they wouldn't bring the customizations over in order to keep the title bar consistent. It isn't consistent even in UWP apps.

I wish they wouldn't bring the customizations over in order to keep the title bar consistent. It isn't consistent even in UWP apps.

By default, the app window gives you the typical TitleBar you would see with Win32 mostly. But many apps use the NavigationView, and that does not look good when it does not extend into the TitleBar.

UWP makes it easy to achieve this, but WInUI Desktop (as of the current spec) will not have a way to achieve this.

image
image
image

_with NavigationView Extended into TitleBar area_


image

image

_customised but not Extended into TitleBar area_


image

image

_without extending into TitleBar_

With all of those apps, the title bar behavior isn't consistent when you put them in Tablet Mode.

With all of those apps, the title bar behavior isn't consistent when you put them in Tablet Mode.

Tablet Mode "should" autohide the Window Controls/TitleBar - This is to have a full-screen experience. I would expect the same behaviour for all WinUI apps, UWP or Win32.

It should but isn't consistent. See Microsoft Store, People app, Photos, and Feedback Hub.

In regards to Win32, I figure that has a lot to do with Sets returning. Programs such as Word were great offenders, obstacles in the way of that initiative.

It _should_ but isn't consistent. See Microsoft Store, People app, Photos, and Feedback Hub.

In regards to Win32, I figure that has a lot to do with Sets returning. Programs such as Word were great offenders, obstacles in the way of that initiative.

Different apps will have different needs. You will never get 100% rigid consistency with TitleBars, but there will be a disparity between UWP app capabilities and WinUI Desktop apps - unless there is sample code for achieving the same effects with HWND interfaces - or these capabilities are introduced.

WPF Windows have options for transparency and titlebar displays - so you should expect WinUI Desktop apps to be capable of matching both UWP behaviours, WPF behaviours, as well as traditional Win32 window behaviours.

I wrote an issue for that in microsoft/ProjectReunion#49 Project Reunion should be the good place for this issue I think

The technical difficulty with this in WinUI3 is enabling a custom title bar that the user can still drag and double-click on. This is enabled in WinUI2 with Window.SetTitleBar, which registers with the shell the system (WinUI2) Visual behind the specified element. But with WinUI3 we need a new mechanism because we don't currently have a system Visual there.

Could WinUI / Reunion include a TitleBar xaml control, with built in behaviours and the ability to re-colour and theme/re-template?

Was this page helpful?
0 / 5 - 0 ratings