-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Why is TitleBar customisation not coming to Win32 WinUI 3 Windows? #2124
Comments
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: #1323 (comment) That might or might not mean support for WinUI desktop. I asked a similar question in the spec: microsoft/microsoft-ui-xaml-specs#71 (comment) |
Then the questions are: |
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. with NavigationView Extended into TitleBar area customised but not Extended into TitleBar area without extending into TitleBar |
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. |
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/WindowsAppSDK#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? |
@MikeHillberg when will titlebar costimizing come to winui3 is very help full feature |
We have a problem with using xBind converters in MainWindow.xaml - they are not working. #4966 pushes to use UI in another file. This make united title and UI impossible. |
I'm curious what the state of this issue is. Today, in Win UI 3 it's possible to set a custom titlebar and extend the view into the titlebar area. There are, however a lot of issues I've seen; I am unable to get any elements in the title bar to respond to click events in the same way they did with UWP, and if you set a background it paints over the min/max/close boxes. From my (uninformed) perspective, the most obvious thing to do for the system when setting a custom titlebar would be to paint the system min/max/close boxes over the top of the element that is set as the titlebar. This would then allow things like a custom background to be set. I really like the idea @mdtauk raised above about having a custom TitleBar xaml control. Another possibility would be to make a templated property (not sure if this is the right term) on the window. |
I'm experiencing a similar issue on my end while exploring WinUI 3 for the first time. I'm having to recreate the TitleBar entirely in order to achieve the same thing that you could use Perhaps my ignorance here is causing my issues. There aren't many resources on WinUI 3 from developers at large so I can better understand certain practices. I'm not creating a UWP app, so this also causes issues. |
@knightmeister not sure if this helps at all, but this doc explains how to properly set colors in custom title bar. Apologies if this isn't your issue. Also in agreement that for custom title bars to have any purpose, we should be able to customize them. That means controls that can exist in that space, i.e. sliding NavigationView into that area, or the occasional button, searchbox, etc. I tend not to like to put anything in the bar, except the aforementioned NavView as @mdtauk points out. |
Hi @tuggernuts, cheers yes I have seen that doc. Getting this all working is very nuanced and would be great if it could be slightly less so. |
I just simply wanting to color the title bar so it fits my app themes |
You can now customize the titlebar of a WinUI app by setting your own UI Element as a custom titlebar. The background of of the titlebar can be set by defining resource keys here https://docs.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.window.settitlebar?view=windows-app-sdk-1.1#colors. You can also set Hopefully this helps. I am closing this issue. Feel free to open it if it doesn't work. |
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:
with NavigationView Extended into TitleBar area
customised but not Extended into TitleBar area
without extending into TitleBar
The text was updated successfully, but these errors were encountered: