-
Notifications
You must be signed in to change notification settings - Fork 348
C++/WinRT - unpackaged - Customized title bar controls not clickable & SetDragRectangle displays default titlebar #3243
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
Comments
Just to be sure, have you tried doing this kind of thing without involving WinUI 3. Don't forget, when you set a custom titlebar, this is set using Microsoft.UI.Xaml.Window, which is a different component to the AppWindowTitleBar used to remove the system title bar and set the drag regions. It is possible that the AppWindowTitleBar is setting everything correctly, but the Xaml host is misbehaving. |
@DarranRowe I posted it originally in the MSDN forum and Castorix gave me the advice to post it in WindowsAppSDK repository, I'm a beginner in C++: |
I would first try to add the compatibility section to your app.manifest., similar to #2969 |
It was more along the lines of asking if it possible to get a test case which tests the titlebar independent of WinUI. However, if you are not that experienced, that may be difficult since it would mean writing an application using the desktop Windows API. |
He added it in app.manifest |
@DarranRowe |
With Win32 APIs, it is done like in the MSDN sample Custom Window Frame Using DWM |
@castorix |
Well, I managed to put a little time into this and got a small Windows API application together that uses ExtendsContentIntoTitleBar for the title bar customisation. 2022-12-16.12-07-26.mp4It seems to be properly clickable and there is no displaying of the default titlebar. It is still only a simple drag rectangle though, but I will be adding in some composition using Windows.UI.Composition to add a sprite visual where the title bar clickable region is. --Edit-- |
@DarranRowe , @castorix |
I keep checking back here and looking for solutions and after 1000 times I saw that WinUI3 is probably not supposed to support it?! https://learn.microsoft.com/en-us/windows/apps/develop/title-bar?tabs=winui3 (As described in the article, it works with the keyboard, but somehow it doesn't make much sense. Don't know where the border is between Windows App SDK and WinUI3) But another error would still exist. If you place a combo box below the title bar and the combo box dropdown opens upwards, then the part that protrudes above the title bar is no longer clickable. There is probably no workaround for this problem that the dropdown only opens downwards. (I tried again with a Rectangle UIElement in the Xaml and it seems to work partially when I set "this->SetTitleBar(myRectangle())" inside the title bar. MyRectangle responds as a drag region, but seems to only pay attention to the non-draggable region to the left.) |
WinUI 3 and Appwindow titlebar now use the same implementation now and hence support the same features. The interactive titlebar can be created using InputNonClientPointerSource apis. I recently added an example in WinUI gallery on how to do it. You can follow it : microsoft/WinUI-Gallery#1360 . It will work for both packaged and unpackaged. Do open a new issue if you still face some issue. Given this issue is fixed, I am closing this. |
Describe the bug
Controls of customized titlebar are not clickable and only by setting "SetDragRectangle" the default titlebar appears and covers the customized titlebar.
As described in this post, the issue should be fixed in Windows App SDK 1.2 Preview 1 (at least in C#, in C++ it doesn't work).
I had 1.1.5 installed before.
#2574
Steps to reproduce the bug
Create an unpackaged WinUI 3 app.
Add the customized titlebar with controls and set "SetDragRectangle".
See my example (code in MainWindow.xaml.cpp):
https://github.com/yki5000/WinUI3_Unpackaged_CPP
See 2 example videos which show you the errors:
yki5000/WinUI3_Unpackaged_CPP#1
Expected behavior
Added titlebar controls should be usable by user input and SetDragRectangle shouldn't let the default titlebar appear (?!).
Screenshots
NuGet package version
1.1.5
Packaging type
Unpackaged
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
The text was updated successfully, but these errors were encountered: