diff --git a/src/modules/cmdpal/WindowsCommandPalette/App.xaml b/src/modules/cmdpal/WindowsCommandPalette/App.xaml
index e134671434..d53606dbfc 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/App.xaml
+++ b/src/modules/cmdpal/WindowsCommandPalette/App.xaml
@@ -1,4 +1,4 @@
-
+
-
+
+
+
-
+
-
-
-
-
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Converters/ReverseBoolToVisibilityConverter.cs b/src/modules/cmdpal/WindowsCommandPalette/Converters/ReverseBoolToVisibilityConverter.cs
new file mode 100644
index 0000000000..19adc6a8ce
--- /dev/null
+++ b/src/modules/cmdpal/WindowsCommandPalette/Converters/ReverseBoolToVisibilityConverter.cs
@@ -0,0 +1,21 @@
+// Copyright (c) Microsoft Corporation
+// The Microsoft Corporation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Data;
+
+namespace WindowsCommandPalette.Converters;
+
+public sealed partial class ReverseBoolToVisibilityConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ return ((bool)value) ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Converters/StringNotEmptyToVisibilityConverter.xaml.cs
similarity index 93%
rename from src/modules/cmdpal/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs
rename to src/modules/cmdpal/WindowsCommandPalette/Converters/StringNotEmptyToVisibilityConverter.xaml.cs
index ac1739f975..d28f87f628 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs
+++ b/src/modules/cmdpal/WindowsCommandPalette/Converters/StringNotEmptyToVisibilityConverter.xaml.cs
@@ -5,7 +5,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
-namespace WindowsCommandPalette.Views;
+namespace WindowsCommandPalette.Converters;
public sealed partial class StringNotEmptyToVisibilityConverter : IValueConverter
{
diff --git a/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml
index 0eea0f3992..1f467cea97 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml
+++ b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml
@@ -1,4 +1,4 @@
-
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
-
-
+
+
-
+
\ No newline at end of file
diff --git a/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs
index 876290519d..094f6c649b 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs
+++ b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs
@@ -7,6 +7,9 @@ using System.Text.RegularExpressions;
using Microsoft.CmdPal.Common.Contracts;
using Microsoft.CmdPal.Common.Extensions;
using Microsoft.CmdPal.Common.Services;
+using Microsoft.UI;
+using Microsoft.UI.Composition;
+using Microsoft.UI.Composition.SystemBackdrops;
using Microsoft.UI.Input;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
@@ -19,13 +22,16 @@ using Windows.System;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
using WindowsCommandPalette.Views;
+using WinRT;
namespace WindowsCommandPalette;
///
/// An empty window that can be used on its own or navigated to within a Frame.
///
+#pragma warning disable CA1001 // Types that own disposable fields should be disposable
public sealed partial class MainWindow : Window
+#pragma warning restore CA1001 // Types that own disposable fields should be disposable
{
private readonly AppWindow _appWindow;
@@ -73,7 +79,9 @@ public sealed partial class MainWindow : Window
MainPage.ViewModel.Summon();
}
+#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
public MainWindow()
+#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
{
InitializeComponent();
_mainViewModel = MainPage.ViewModel;
@@ -88,7 +96,7 @@ public sealed partial class MainWindow : Window
Activated += MainWindow_Activated;
AppTitleBar.SizeChanged += AppTitleBar_SizeChanged;
-
+ SetAcrylic();
ExtendsContentIntoTitleBar = true;
// Hide our titlebar. We'll make the sides draggable later
@@ -124,7 +132,7 @@ public sealed partial class MainWindow : Window
private void PositionCentered()
{
- _appWindow.Resize(new SizeInt32 { Width = 860, Height = 512 });
+ _appWindow.Resize(new SizeInt32 { Width = 860, Height = 560 });
DisplayArea displayArea = DisplayArea.GetFromWindowId(_appWindow.Id, DisplayAreaFallback.Nearest);
if (displayArea is not null)
{
@@ -264,8 +272,9 @@ public sealed partial class MainWindow : Window
{
if (args.WindowActivationState == WindowActivationState.Deactivated)
{
- AppTitleTextBlock.Foreground =
- (SolidColorBrush)App.Current.Resources["WindowCaptionForegroundDisabled"];
+ AppTitleTextBlock.Foreground = (SolidColorBrush)App.Current.Resources["WindowCaptionForegroundDisabled"];
+
+ _configurationSource.IsInputActive = false;
// If there's a debugger attached...
if (System.Diagnostics.Debugger.IsAttached)
@@ -280,8 +289,8 @@ public sealed partial class MainWindow : Window
}
else
{
- AppTitleTextBlock.Foreground =
- (SolidColorBrush)App.Current.Resources["WindowCaptionForeground"];
+ AppTitleTextBlock.Foreground = (SolidColorBrush)App.Current.Resources["WindowCaptionForeground"];
+ _configurationSource.IsInputActive = true;
}
}
@@ -391,5 +400,87 @@ public sealed partial class MainWindow : Window
// WinUI bug is causing a crash on shutdown when FailFastOnErrors is set to true (#51773592).
// Workaround by turning it off before shutdown.
App.Current.DebugSettings.FailFastOnErrors = false;
+ DisposeAcrylic();
+ }
+
+ private DesktopAcrylicController _acrylicController;
+ private SystemBackdropConfiguration _configurationSource;
+
+ // We want to use DesktopAcrylicKind.Thin and custom colors as this is the default material other Shell surfaces are using, this cannot be set in XAML however.
+ private void SetAcrylic()
+ {
+ if (DesktopAcrylicController.IsSupported())
+ {
+ // Hooking up the policy object.
+ _configurationSource = new SystemBackdropConfiguration();
+
+ ((FrameworkElement)this.Content).ActualThemeChanged += MainWindow_ActualThemeChanged;
+
+ // Initial configuration state.
+ _configurationSource.IsInputActive = true;
+ UpdateAcrylic();
+ }
+ }
+
+ private void UpdateAcrylic()
+ {
+ _acrylicController = GetAcrylicConfig();
+
+ // Enable the system backdrop.
+ // Note: Be sure to have "using WinRT;" to support the Window.As<...>() call.
+ _acrylicController.AddSystemBackdropTarget(this.As());
+ _acrylicController.SetSystemBackdropConfiguration(_configurationSource);
+ }
+
+ private DesktopAcrylicController GetAcrylicConfig()
+ {
+ if (((FrameworkElement)this.Content).ActualTheme == ElementTheme.Light)
+ {
+ return new DesktopAcrylicController()
+ {
+ Kind = DesktopAcrylicKind.Thin,
+ TintColor = Windows.UI.Color.FromArgb(255, 243, 243, 243),
+ LuminosityOpacity = 0.90f,
+ TintOpacity = 0.0f,
+ FallbackColor = Windows.UI.Color.FromArgb(255, 238, 238, 238),
+ };
+ }
+ else
+ {
+ return new DesktopAcrylicController()
+ {
+ Kind = DesktopAcrylicKind.Thin,
+ TintColor = Windows.UI.Color.FromArgb(255, 32, 32, 32),
+ LuminosityOpacity = 0.96f,
+ TintOpacity = 0.5f,
+ FallbackColor = Windows.UI.Color.FromArgb(255, 28, 28, 28),
+ };
+ }
+ }
+
+ private void MainWindow_ActualThemeChanged(FrameworkElement sender, object args)
+ {
+ SetConfigurationSourceTheme(sender.ActualTheme);
+ UpdateAcrylic();
+ }
+
+ private void SetConfigurationSourceTheme(ElementTheme theme)
+ {
+ switch (theme)
+ {
+ case ElementTheme.Dark: _configurationSource.Theme = SystemBackdropTheme.Dark; break;
+ case ElementTheme.Light: _configurationSource.Theme = SystemBackdropTheme.Light; break;
+ case ElementTheme.Default: _configurationSource.Theme = SystemBackdropTheme.Default; break;
+ }
+ }
+
+ private void DisposeAcrylic()
+ {
+ if (_acrylicController != null)
+ {
+ _acrylicController.Dispose();
+ _acrylicController = null!;
+ _configurationSource = null!;
+ }
}
}
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj b/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj
index c54f812f98..c78ec42193 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj
+++ b/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj
@@ -95,11 +95,21 @@
+
+
+ MSBuild:Compile
+
+
MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Styles/Button.xaml b/src/modules/cmdpal/WindowsCommandPalette/Styles/Button.xaml
new file mode 100644
index 0000000000..20e0600b62
--- /dev/null
+++ b/src/modules/cmdpal/WindowsCommandPalette/Styles/Button.xaml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Styles/TextBox.xaml b/src/modules/cmdpal/WindowsCommandPalette/Styles/TextBox.xaml
new file mode 100644
index 0000000000..59dda19403
--- /dev/null
+++ b/src/modules/cmdpal/WindowsCommandPalette/Styles/TextBox.xaml
@@ -0,0 +1,275 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml
index 47f3681eb0..452f53750f 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml
+++ b/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml
@@ -1,47 +1,55 @@
-
+
-
+
-
-
+
+
-
-
-
+
+
+
-
+
+
+
-
-
-
-
+ Visibility="{x:Bind ViewModel.Title, Converter={StaticResource StringNotEmptyToVisibilityConverter}, Mode=OneWay}" />
+
+
-
-
-
+
\ No newline at end of file
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml
index 2a7ee6b70f..1e2fe51048 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml
+++ b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml
@@ -3,59 +3,65 @@
x:Class="WindowsCommandPalette.Views.FormPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:WindowsCommandPalette.Views"
xmlns:ac="using:AdaptiveCards.Rendering.WinUI3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="using:WindowsCommandPalette.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
Background="Transparent"
- Loaded="Page_Loaded">
+ Loaded="Page_Loaded"
+ mc:Ignorable="d">
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml
index 611d807f0f..ef5fa223b2 100644
--- a/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml
+++ b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml
@@ -1,96 +1,128 @@
-
+
+ Loaded="Page_Loaded"
+ mc:Ignorable="d">
+
-
-
+
+
-
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
@@ -98,8 +130,7 @@
-