Skip to content

Commit

Permalink
Style 'AppWindow' title bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Aug 29, 2024
1 parent 5cb2512 commit d6105a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Windowing;
using Windows.UI;

namespace ComputeSharp.SwapChain.D2D1.Backend;

Expand All @@ -24,6 +25,22 @@ public static void Run(Win32Application application, string windowTitle)
appWindow.Title = windowTitle;
appWindow.TitleBar.ExtendsContentIntoTitleBar = true;

// Transparent colors for the title bar
appWindow.TitleBar.ForegroundColor = Colors.Transparent;
appWindow.TitleBar.BackgroundColor = Colors.Transparent;
appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent;
appWindow.TitleBar.InactiveBackgroundColor = Colors.Transparent;
appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

// Theme aware colors for the title bar
appWindow.TitleBar.ButtonForegroundColor = Colors.White;
appWindow.TitleBar.ButtonHoverForegroundColor = Colors.White;
appWindow.TitleBar.ButtonPressedForegroundColor = Colors.White;
appWindow.TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF);
appWindow.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF);
appWindow.TitleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF);
appWindow.TitleBar.InactiveForegroundColor = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0);

// Initialize the application
application.OnInitialize(appWindow);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<CsWinRTUseExceptionResourceKeys>true</CsWinRTUseExceptionResourceKeys>
<CsWinRTEnableDefaultCustomTypeMappings>false</CsWinRTEnableDefaultCustomTypeMappings>
<CsWinRTEnableICustomPropertyProviderSupport>false</CsWinRTEnableICustomPropertyProviderSupport>
<CsWinRTEnableIReferenceSupport>false</CsWinRTEnableIReferenceSupport>
<CsWinRTEnableIDynamicInterfaceCastableSupport>false</CsWinRTEnableIDynamicInterfaceCastableSupport>
</PropertyGroup>

Expand Down

0 comments on commit d6105a3

Please sign in to comment.