question

ShwetaH-8598 avatar image
0 Votes"
ShwetaH-8598 asked ShwetaH-8598 commented

Custom title bar not working in Unpackaged mode of Winui3 in Windows 10

Hi,
I have created Winui3vApp with custom title bar by using below link
https://docs.microsoft.com/en-us/windows/apps/develop/title-bar?msclkid=e23d7633cf9311eca704e47ee540cf97&tabs=wasdk

the windows default caption buttons works in packaged mode but not working in unpackaged
Even after adding compatability code in App.manifest .

is there any way to make custom titlebar in winui3 unpackaged mode Windows 10 OS?

windows-app-sdk
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

In Title bar customization, which content do you code according to? If you don't add Title bar, can you run in unpackaged mode?


0 Votes 0 ·

1 Answer

Castorix31 avatar image
1 Vote"
Castorix31 answered ShwetaH-8598 commented

I just uploaded a test sample which works fine on my OS (Windows 10 21H1) : WinUI3_CustomCaption

I added the 2 styles from generic.xaml in App.xaml to customize System Buttons (rounded for the test) :


200666-winui3-customtitlebar.jpg





· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,
thanks for sharing is it package or unpackage mode?

0 Votes 0 ·

Unpackaged

0 Votes 0 ·

@Castorix31 thank you so much for sharing the code here i can see the caption button content is some coded word like Content="M 0 0 L 10 10 M 10 0 L 0 10" can we add custom button to in the region of default caption button?

0 Votes 0 ·

It does not seem easy ; I did some tests :
if I remove the "MinimizeButton" Button, it crashes, and if I hide it or reduce its size, and I add another Button to replace it, it ignores the mouse...

0 Votes 0 ·

yes but i have used Iscustomization support handle interactive buttons i can
if (IsCustomizationSupported)
{
AW = GetAppWindowForCurrentWindow();
AW.TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.Height = AW.TitleBar.Height;
// SetTitleBar(CustomDragRegion);
AW.Closing += AW_Closing;
CustomDragRegion.SizeChanged += CustomDragRegion_SizeChanged;
}
else
{
TitleBar.BackgroundTransition = null;
TitleBar.Background = null;
ExtendsContentIntoTitleBar = true;
TitleBar.Height = 35;

             SetTitleBar(CustomDragRegion);
                
         }



i can able to interact with button but drag is not working i can not able to move window, if i remove that button it works fine but extending the customtitlebar towards caption not allowing to drag or move

0 Votes 0 ·
Show more comments