From f84bbdc20a2195071ff27ef359fe02c5af145b84 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 25 Jul 2024 22:54:22 -0700 Subject: [PATCH] Add 'ApplicationViewTitleBarExtensions' type --- .../ApplicationViewTitleBarExtensions.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 samples/ComputeSharp.SwapChain.D2D1.CoreWindow/Extensions/ApplicationViewTitleBarExtensions.cs diff --git a/samples/ComputeSharp.SwapChain.D2D1.CoreWindow/Extensions/ApplicationViewTitleBarExtensions.cs b/samples/ComputeSharp.SwapChain.D2D1.CoreWindow/Extensions/ApplicationViewTitleBarExtensions.cs new file mode 100644 index 00000000..cc9365ca --- /dev/null +++ b/samples/ComputeSharp.SwapChain.D2D1.CoreWindow/Extensions/ApplicationViewTitleBarExtensions.cs @@ -0,0 +1,33 @@ +using Windows.UI; +using Windows.UI.ViewManagement; + +namespace ComputeSharp.SwapChain.D2D1.CoreWindow.Extensions; + +/// +/// Extensions for . +/// +internal static class ApplicationViewTitleBarExtensions +{ + /// + /// Styles the title bar to look correctly when the view is expanded into it. + /// + /// The input title bar. + public static void StyleTitleBarForExtendedIntoViewMode(this ApplicationViewTitleBar titleBar) + { + // Transparent colors + titleBar.ForegroundColor = Colors.Transparent; + titleBar.BackgroundColor = Colors.Transparent; + titleBar.ButtonBackgroundColor = Colors.Transparent; + titleBar.InactiveBackgroundColor = Colors.Transparent; + titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + + // Theme aware colors + titleBar.ButtonForegroundColor = Colors.White; + titleBar.ButtonHoverForegroundColor = Colors.White; + titleBar.ButtonPressedForegroundColor = Colors.White; + titleBar.ButtonHoverBackgroundColor = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF); + titleBar.ButtonPressedBackgroundColor = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF); + titleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF); + titleBar.InactiveForegroundColor = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0); + } +}