From 72f62c57184af552fa7b999c6f1841b8c0fa1fc3 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Fri, 20 Jun 2025 16:02:19 +0200 Subject: [PATCH 01/24] Cleaning up Controls folder --- src/settings-ui/Settings.UI/SettingsXAML/App.xaml | 2 +- .../Controls/{FlyoutMenuButton => }/FlyoutMenuButton.xaml | 0 .../FlyoutMenuButton.cs => FlyoutMenuButton.xaml.cs} | 0 .../Controls/{IsEnabledTextBlock => }/IsEnabledTextBlock.xaml | 0 .../IsEnabledTextBlock.cs => IsEnabledTextBlock.xaml.cs} | 0 .../SettingsXAML/Controls/{KeyVisual => }/KeyVisual.xaml | 0 .../Controls/{KeyVisual/KeyVisual.cs => KeyVisual.xaml.cs} | 0 .../Controls/{OOBEPageControl => }/OOBEPageControl.xaml | 0 .../Controls/{OOBEPageControl => }/OOBEPageControl.xaml.cs | 0 .../SettingsGroup/{SettingsGroup.cs => SettingsGroup.xaml.cs} | 0 10 files changed, 1 insertion(+), 1 deletion(-) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{FlyoutMenuButton => }/FlyoutMenuButton.xaml (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{FlyoutMenuButton/FlyoutMenuButton.cs => FlyoutMenuButton.xaml.cs} (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{IsEnabledTextBlock => }/IsEnabledTextBlock.xaml (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{IsEnabledTextBlock/IsEnabledTextBlock.cs => IsEnabledTextBlock.xaml.cs} (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{KeyVisual => }/KeyVisual.xaml (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{KeyVisual/KeyVisual.cs => KeyVisual.xaml.cs} (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{OOBEPageControl => }/OOBEPageControl.xaml (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/{OOBEPageControl => }/OOBEPageControl.xaml.cs (100%) rename src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/{SettingsGroup.cs => SettingsGroup.xaml.cs} (100%) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml index c1a5392bdc..99bdca39b4 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml @@ -8,7 +8,7 @@ - + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton/FlyoutMenuButton.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton.xaml similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton/FlyoutMenuButton.xaml rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton.xaml diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton/FlyoutMenuButton.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton.xaml.cs similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton/FlyoutMenuButton.cs rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/FlyoutMenuButton.xaml.cs diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock.xaml similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock.xaml diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock.xaml.cs similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock.xaml.cs diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml.cs similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual/KeyVisual.cs rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml.cs diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl/OOBEPageControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl.xaml similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl/OOBEPageControl.xaml rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl.xaml diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl/OOBEPageControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl.xaml.cs similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl/OOBEPageControl.xaml.cs rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/OOBEPageControl.xaml.cs diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.xaml.cs similarity index 100% rename from src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.cs rename to src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.xaml.cs From e1bcf62b848d2c28cec81b74e48ff0d166f4520c Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Fri, 20 Jun 2025 16:02:29 +0200 Subject: [PATCH 02/24] Adding Card control --- .../SettingsXAML/Controls/Card.xaml | 93 +++++++++++++++++++ .../SettingsXAML/Controls/Card.xaml.cs | 91 ++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml create mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml.cs diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml new file mode 100644 index 0000000000..719c02e97f --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml.cs new file mode 100644 index 0000000000..ad24a49ed8 --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml.cs @@ -0,0 +1,91 @@ +// 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.Controls; + +namespace Microsoft.PowerToys.Settings.UI.SettingsXAML.Controls +{ + public sealed partial class Card : UserControl + { + public static readonly DependencyProperty TitleContentProperty = DependencyProperty.Register(nameof(TitleContent), typeof(object), typeof(Card), new PropertyMetadata(defaultValue: null, OnVisualPropertyChanged)); + + public object TitleContent + { + get => (object)GetValue(TitleContentProperty); + set => SetValue(TitleContentProperty, value); + } + + public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(Card), new PropertyMetadata(defaultValue: null, OnVisualPropertyChanged)); + + public string Title + { + get => (string)GetValue(TitleProperty); + set => SetValue(TitleProperty, value); + } + + public static new readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(object), typeof(Card), new PropertyMetadata(defaultValue: null)); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1061:Do not hide base class methods", Justification = "We need to hide the base class method")] + public new object Content + { + get => (object)GetValue(ContentProperty); + set => SetValue(ContentProperty, value); + } + + public static readonly DependencyProperty TitlePaddingProperty = DependencyProperty.Register(nameof(TitlePadding), typeof(Thickness), typeof(Card), new PropertyMetadata(defaultValue: new Thickness(12, 12, 16, 12))); + + public Thickness TitlePadding + { + get => (Thickness)GetValue(TitlePaddingProperty); + set => SetValue(TitlePaddingProperty, value); + } + + public static readonly DependencyProperty DividerVisibilityProperty = DependencyProperty.Register(nameof(DividerVisibility), typeof(Visibility), typeof(Card), new PropertyMetadata(defaultValue: null)); + + public Visibility DividerVisibility + { + get => (Visibility)GetValue(DividerVisibilityProperty); + set => SetValue(DividerVisibilityProperty, value); + } + + public static readonly DependencyProperty IconProperty = DependencyProperty.Register(nameof(Icon), typeof(IconElement), typeof(Card), new PropertyMetadata(defaultValue: null, OnVisualPropertyChanged)); + + public IconElement Icon + { + get => (IconElement)GetValue(IconProperty); + set => SetValue(IconProperty, value); + } + + public Card() + { + InitializeComponent(); + SetVisualStates(); + } + + private static void OnVisualPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (d is Card card) + { + card.SetVisualStates(); + } + } + + private void SetVisualStates() + { + VisualStateManager.GoToState(this, Icon != null ? "IconVisible" : "IconCollapsed", true); + + if (string.IsNullOrEmpty(Title) && Icon == null && TitleContent == null) + { + VisualStateManager.GoToState(this, "TitleGridCollapsed", true); + DividerVisibility = Visibility.Collapsed; + } + else + { + VisualStateManager.GoToState(this, "TitleGridVisible", true); + DividerVisibility = Visibility.Visible; + } + } + } +} From faab625a253bb457e1876776b9a38dcaa4f3fc39 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Fri, 20 Jun 2025 18:28:28 +0200 Subject: [PATCH 03/24] Dashboard changes --- .../Settings.UI/PowerToys.Settings.csproj | 4 + .../Settings.UI/SettingsXAML/App.xaml | 1 + .../SettingsXAML/Controls/Card.xaml | 33 +- .../SettingsXAML/Controls/Card.xaml.cs | 22 +- .../SettingsPageControl.xaml | 1 - .../SettingsXAML/Views/DashboardPage.xaml | 338 +++++++----------- .../SettingsXAML/Views/DashboardPage.xaml.cs | 1 - .../Settings.UI/Strings/en-us/Resources.resw | 30 +- .../ViewModels/DashboardModuleItem.cs | 18 +- .../ViewModels/DashboardViewModel.cs | 24 +- 10 files changed, 165 insertions(+), 307 deletions(-) diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj index 2451855cd2..d55b34493f 100644 --- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj +++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj @@ -22,6 +22,7 @@ + @@ -132,6 +133,9 @@ Always + + MSBuild:Compile + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml index 99bdca39b4..cb527f3924 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml @@ -46,6 +46,7 @@ 16,0,0,0 240 + 1000 + + + - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml.cs index 9d323c636d..d343ec23b1 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml.cs @@ -5,6 +5,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Markup; +using Microsoft.UI.Xaml.Media; using Windows.System; namespace Microsoft.PowerToys.Settings.UI.Controls @@ -12,8 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls [TemplatePart(Name = KeyPresenter, Type = typeof(ContentPresenter))] [TemplateVisualState(Name = "Normal", GroupName = "CommonStates")] [TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")] - [TemplateVisualState(Name = "Default", GroupName = "StateStates")] - [TemplateVisualState(Name = "Error", GroupName = "StateStates")] + [TemplateVisualState(Name = "Error", GroupName = "CommonStates")] public sealed partial class KeyVisual : Control { private const string KeyPresenter = "KeyPresenter"; @@ -26,28 +26,19 @@ namespace Microsoft.PowerToys.Settings.UI.Controls set => SetValue(ContentProperty, value); } - public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string), OnContentChanged)); + public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string), OnContentChanged)); - public VisualType VisualType + public bool IsInvalid { - get => (VisualType)GetValue(VisualTypeProperty); - set => SetValue(VisualTypeProperty, value); + get => (bool)GetValue(IsInvalidProperty); + set => SetValue(IsInvalidProperty, value); } - public static readonly DependencyProperty VisualTypeProperty = DependencyProperty.Register("VisualType", typeof(VisualType), typeof(KeyVisual), new PropertyMetadata(default(VisualType), OnSizeChanged)); - - public bool IsError - { - get => (bool)GetValue(IsErrorProperty); - set => SetValue(IsErrorProperty, value); - } - - public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnIsErrorChanged)); + public static readonly DependencyProperty IsInvalidProperty = DependencyProperty.Register(nameof(IsInvalid), typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnIsInvalidChanged)); public KeyVisual() { this.DefaultStyleKey = typeof(KeyVisual); - this.Style = GetStyleSize("TextKeyVisualStyle"); } protected override void OnApplyTemplate() @@ -56,48 +47,55 @@ namespace Microsoft.PowerToys.Settings.UI.Controls _keyVisual = (KeyVisual)this; _keyPresenter = (ContentPresenter)_keyVisual.GetTemplateChild(KeyPresenter); Update(); - SetEnabledState(); - SetErrorState(); + SetVisualStates(); IsEnabledChanged += KeyVisual_IsEnabledChanged; base.OnApplyTemplate(); } private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - ((KeyVisual)d).Update(); + ((KeyVisual)d).SetVisualStates(); } - private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + private static void OnIsInvalidChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - ((KeyVisual)d).Update(); + ((KeyVisual)d).SetVisualStates(); } - private static void OnIsErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + private void SetVisualStates() { - ((KeyVisual)d).SetErrorState(); + if (_keyVisual != null) + { + if (_keyVisual.IsInvalid) + { + VisualStateManager.GoToState(_keyVisual, "Invalid", true); + } + else if (!_keyVisual.IsEnabled) + { + VisualStateManager.GoToState(_keyVisual, "Disabled", true); + } + else + { + VisualStateManager.GoToState(_keyVisual, "Normal", true); + } + } } private void Update() { - if (_keyVisual == null) - { - return; - } - - if (_keyVisual.Content != null) + if (_keyVisual != null && _keyVisual.Content != null) { if (_keyVisual.Content.GetType() == typeof(string)) { - _keyVisual.Style = GetStyleSize("TextKeyVisualStyle"); _keyVisual._keyPresenter.Content = _keyVisual.Content; + _keyVisual._keyPresenter.Margin = new Thickness(0, -1, 0, 0); } else { - _keyVisual.Style = GetStyleSize("IconKeyVisualStyle"); - + _keyVisual._keyPresenter.Margin = new Thickness(0, 2, 0, 2); + _keyVisual._keyPresenter.FontFamily = new FontFamily("Segoe Fluent Icons, Segoe MDL2 Assets"); switch ((int)_keyVisual.Content) { - /* We can enable other glyphs in the future case 13: // The Enter key or button. _keyVisual._keyPresenter.Content = "\uE751"; break; @@ -107,7 +105,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls case 16: // The right Shift key or button. case 160: // The left Shift key or button. case 161: // The Shift key or button. - _keyVisual._keyPresenter.Content = "\uE752"; break; */ + _keyVisual._keyPresenter.Content = "\uE752"; break; case 38: _keyVisual._keyPresenter.Content = "\uE0E4"; break; // The Up Arrow key or button. case 40: _keyVisual._keyPresenter.Content = "\uE0E5"; break; // The Down Arrow key or button. @@ -116,13 +114,13 @@ namespace Microsoft.PowerToys.Settings.UI.Controls case 91: // The left Windows key case 92: // The right Windows key - PathIcon winIcon = XamlReader.Load(@"") as PathIcon; + PathIcon winIcon = XamlReader.Load(@"") as PathIcon; Viewbox winIconContainer = new Viewbox(); winIconContainer.Child = winIcon; winIconContainer.HorizontalAlignment = HorizontalAlignment.Center; winIconContainer.VerticalAlignment = VerticalAlignment.Center; - double iconDimensions = GetIconSize(); + double iconDimensions = _keyVisual.FontSize * 0.9; // Adjust the size of the icon based on the font size winIconContainer.Height = iconDimensions; winIconContainer.Width = iconDimensions; _keyVisual._keyPresenter.Content = winIconContainer; @@ -133,59 +131,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls } } - public Style GetStyleSize(string styleName) - { - if (VisualType == VisualType.Small) - { - return (Style)App.Current.Resources["Small" + styleName]; - } - else if (VisualType == VisualType.SmallOutline) - { - return (Style)App.Current.Resources["SmallOutline" + styleName]; - } - else if (VisualType == VisualType.TextOnly) - { - return (Style)App.Current.Resources["Only" + styleName]; - } - else - { - return (Style)App.Current.Resources["Default" + styleName]; - } - } - - public double GetIconSize() - { - if (VisualType == VisualType.Small || VisualType == VisualType.SmallOutline) - { - return (double)App.Current.Resources["SmallIconSize"]; - } - else - { - return (double)App.Current.Resources["DefaultIconSize"]; - } - } - private void KeyVisual_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { - SetEnabledState(); + SetVisualStates(); } - - private void SetErrorState() - { - VisualStateManager.GoToState(this, IsError ? "Error" : "Default", true); - } - - private void SetEnabledState() - { - VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true); - } - } - - public enum VisualType - { - Small, - SmallOutline, - TextOnly, - Large, } } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml index c115d1febe..09b2d7d26a 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml @@ -31,8 +31,7 @@ VerticalAlignment="Center" AutomationProperties.AccessibilityView="Raw" Content="{Binding}" - IsTabStop="False" - VisualType="SmallOutline" /> + IsTabStop="False" /> diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml index cac7e3ed09..04f5e505b0 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml @@ -17,36 +17,38 @@ Padding="0" Click="OpenDialogButton_Click" CornerRadius="8"> - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml index 8765a3d4b3..6f2f186fb6 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml @@ -34,12 +34,12 @@ + FontSize="20" Style="{StaticResource AccentKeyVisualStyle}" + IsInvalid="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}" + IsTabStop="False" /> diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml index 23f2d3cc2b..78d95a4c3b 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml @@ -28,11 +28,11 @@ + FontSize="12" + IsTabStop="False" /> diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 5bdd5c4f1b..6f6fdf8460 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -43,10 +43,11 @@ - + @@ -57,21 +58,15 @@ - - - + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml index f6e7a3fddb..9b3b813878 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml @@ -25,11 +25,11 @@ - + - + - - - + + + + + + + Style="{StaticResource CaptionTextBlockStyle}" + Text="Version 0.91" /> + + + + @@ -147,6 +196,7 @@ @@ -158,14 +208,68 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -176,6 +280,7 @@ - + @@ -198,6 +303,7 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml.cs index 4130f94f8a..53ff1951a9 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml.cs @@ -54,5 +54,19 @@ namespace Microsoft.PowerToys.Settings.UI.Views { ViewModel.DashboardListItemClick(sender); } + + private void WhatsNewButton_Click(object sender, RoutedEventArgs e) + { + if (App.GetOobeWindow() == null) + { + App.SetOobeWindow(new OobeWindow(Microsoft.PowerToys.Settings.UI.OOBE.Enums.PowerToysModules.WhatsNew)); + } + else + { + App.GetOobeWindow().SetAppWindow(OOBE.Enums.PowerToysModules.WhatsNew); + } + + App.GetOobeWindow().Activate(); + } } } diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs index 78d7c76c3f..8be87e7009 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs @@ -8,7 +8,7 @@ using System.Collections.ObjectModel; using System.IO.Abstractions; using System.Linq; using System.Windows.Threading; - +using CommunityToolkit.WinUI.Controls; using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; @@ -33,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public ObservableCollection ShortcutModules { get; set; } = new ObservableCollection(); - public ObservableCollection ButtonModules { get; set; } = new ObservableCollection(); + public ObservableCollection ActionModules { get; set; } = new ObservableCollection(); public bool UpdateAvailable { get; set; } @@ -106,7 +106,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void GetShortcutModules() { ShortcutModules.Clear(); - ButtonModules.Clear(); + ActionModules.Clear(); foreach (var x in AllModules.Where(x => x.IsEnabled)) { @@ -128,6 +128,27 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels }); } } + + foreach (var x in AllModules.Where(x => x.IsEnabled)) + { + var filteredItems = x.DashboardModuleItems + .Where(m => m is DashboardModuleButtonItem) + .ToList(); + + if (filteredItems.Count != 0) + { + ActionModules.Add(new DashboardListItem + { + EnabledChangedCallback = x.EnabledChangedCallback, + Icon = x.Icon, + IsLocked = x.IsLocked, + Label = x.Label, + Tag = x.Tag, + IsEnabled = x.IsEnabled, + DashboardModuleItems = new ObservableCollection(filteredItems), + }); + } + } } private ObservableCollection GetModuleItems(ModuleType moduleType) @@ -174,7 +195,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels var list = new List { - new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("CmdPal_ShortDescription"), Shortcut = hotkey.GetKeysList() }, + new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("CmdPal_ActivationDescription"), Shortcut = hotkey.GetKeysList() }, }; return new ObservableCollection(list); } @@ -216,15 +237,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { ISettingsRepository moduleSettingsRepository = SettingsRepository.GetInstance(new SettingsUtils()); var settings = moduleSettingsRepository.SettingsConfig; - string activationMode = $"{resourceLoader.GetString(settings.Properties.FancyzonesShiftDrag.Value ? "FancyZones_ShiftDragCheckBoxControl_Header/Content" : "FancyZones_ActivationNoShiftDrag")}."; - if (settings.Properties.FancyzonesMouseSwitch.Value) - { - activationMode += $" {resourceLoader.GetString("FancyZones_MouseDragCheckBoxControl_Header/Content")}."; - } + string activationMode = $"{resourceLoader.GetString(settings.Properties.FancyzonesShiftDrag.Value ? "FancyZones_ActivationShiftDrag" : "FancyZones_ActivationNoShiftDrag")}."; var list = new List { - new DashboardModuleActivationItem() { Label = resourceLoader.GetString("Dashboard_Activation"), Activation = activationMode }, + new DashboardModuleActivationItem() { Label = resourceLoader.GetString("Activate_Zones"), Activation = activationMode }, new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("FancyZones_OpenEditor"), Shortcut = settings.Properties.FancyzonesEditorHotkey.Value.GetKeysList() }, new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "\uEB3C", ButtonClickHandler = FancyZoneLaunchClicked }, }; @@ -449,20 +466,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SendConfigMSG("{\"action\":{\"Workspaces\":{\"action_name\":\"LaunchEditor\", \"value\":\"\"}}}"); } - private void KbmKeyLaunchClicked(object sender, RoutedEventArgs e) - { - var settingsUtils = new SettingsUtils(); - var kbmViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, KeyboardManagerPage.FilterRemapKeysList); - kbmViewModel.OnRemapKeyboard(); - } - - private void KbmShortcutLaunchClicked(object sender, RoutedEventArgs e) - { - var settingsUtils = new SettingsUtils(); - var kbmViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, KeyboardManagerPage.FilterRemapKeysList); - kbmViewModel.OnEditShortcut(); - } - private void RegistryPreviewLaunchClicked(object sender, RoutedEventArgs e) { var actionName = "Launch"; @@ -471,20 +474,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels internal void DashboardListItemClick(object sender) { - Button button = sender as Button; - if (button == null) + if (sender is SettingsCard card && card.Tag is ModuleType moduleType) { - return; + NavigationService.Navigate(ModuleHelper.GetModulePageType(moduleType)); } - - if (!(button.Tag is ModuleType)) - { - return; - } - - ModuleType moduleType = (ModuleType)button.Tag; - - NavigationService.Navigate(ModuleHelper.GetModulePageType(moduleType)); } } } From 5457b27d5478f47cb877e7cc8b11e32c6d4d18b7 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Wed, 25 Jun 2025 16:54:36 +0200 Subject: [PATCH 10/24] Adding icons to the quick actions --- .../SettingsXAML/Views/DashboardPage.xaml | 63 ++++++++----------- .../ViewModels/DashboardViewModel.cs | 10 +-- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 7e07500a90..0df37f062f 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -28,13 +28,6 @@ FalseValue="Visible" TrueValue="Collapsed" /> - - + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs index 8be87e7009..172816dbf4 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs @@ -228,7 +228,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { var list = new List { - new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Description"), ButtonGlyph = "\uEA37", ButtonClickHandler = EnvironmentVariablesLaunchClicked }, + new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/EnvironmentVariables.png", ButtonClickHandler = EnvironmentVariablesLaunchClicked }, }; return new ObservableCollection(list); } @@ -243,7 +243,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { new DashboardModuleActivationItem() { Label = resourceLoader.GetString("Activate_Zones"), Activation = activationMode }, new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("FancyZones_OpenEditor"), Shortcut = settings.Properties.FancyzonesEditorHotkey.Value.GetKeysList() }, - new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "\uEB3C", ButtonClickHandler = FancyZoneLaunchClicked }, + new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/FancyZones.png", ButtonClickHandler = FancyZoneLaunchClicked }, }; return new ObservableCollection(list); } @@ -281,7 +281,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { var list = new List { - new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Hosts_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("Hosts_LaunchButtonControl/Description"), ButtonGlyph = "\uEA37", ButtonClickHandler = HostLaunchClicked }, + new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Hosts_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("Hosts_LaunchButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/Hosts.png", ButtonClickHandler = HostLaunchClicked }, }; return new ObservableCollection(list); } @@ -386,7 +386,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels var list = new List { new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("Workspaces_ShortDescription"), Shortcut = settings.Properties.Hotkey.Value.GetKeysList() }, - new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Workspaces_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "\uEB3C", ButtonClickHandler = WorkspacesLaunchClicked }, + new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Workspaces_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/Workspaces.png", ButtonClickHandler = WorkspacesLaunchClicked }, }; return new ObservableCollection(list); } @@ -395,7 +395,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { var list = new List { - new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("RegistryPreview_LaunchButtonControl/Header"), ButtonGlyph = "\uEA37", ButtonClickHandler = RegistryPreviewLaunchClicked }, + new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("RegistryPreview_LaunchButtonControl/Header"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/RegistryPreview.png", ButtonClickHandler = RegistryPreviewLaunchClicked }, }; return new ObservableCollection(list); } From c1564db8656cbfb4f2c015b944daa3f047465a03 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Fri, 27 Jun 2025 10:51:09 +0200 Subject: [PATCH 11/24] CI fixes --- src/settings-ui/Settings.UI/PowerToys.Settings.csproj | 4 ---- .../Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj index d55b34493f..2451855cd2 100644 --- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj +++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj @@ -22,7 +22,6 @@ - @@ -133,9 +132,6 @@ Always - - MSBuild:Compile - diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml index 9b3b813878..7ac704ae76 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml @@ -29,7 +29,7 @@ - + - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs index e33127572d..c75017300c 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; - using CommunityToolkit.WinUI; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; @@ -11,6 +10,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Automation; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; +using Microsoft.Windows.ApplicationModel.Resources; using Windows.System; namespace Microsoft.PowerToys.Settings.UI.Controls @@ -36,6 +36,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls public static readonly DependencyProperty AllowDisableProperty = DependencyProperty.Register("AllowDisable", typeof(bool), typeof(ShortcutControl), new PropertyMetadata(false, OnAllowDisableChanged)); + private static ResourceLoader resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader; + private static void OnAllowDisableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var me = d as ShortcutControl; @@ -50,8 +52,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls return; } - var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader; - var newValue = (bool)(e?.NewValue ?? false); var text = newValue ? resourceLoader.GetString("Activation_Shortcut_With_Disable_Description") : resourceLoader.GetString("Activation_Shortcut_Description"); @@ -103,8 +103,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls { hotkeySettings = value; SetValue(HotkeySettingsProperty, value); - PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList(); - AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString()); + SetKeys(); c.Keys = HotkeySettings.GetKeysList(); } } @@ -118,8 +117,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls this.Unloaded += ShortcutControl_Unloaded; this.Loaded += ShortcutControl_Loaded; - var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader; - // We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme. shortcutDialog = new ContentDialog { @@ -433,11 +430,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls hotkeySettings = null; SetValue(HotkeySettingsProperty, hotkeySettings); - PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList(); + SetKeys(); lastValidSettings = hotkeySettings; - - AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString()); shortcutDialog.Hide(); } @@ -448,8 +443,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls HotkeySettings = lastValidSettings with { }; } - PreviewKeysControl.ItemsSource = hotkeySettings.GetKeysList(); - AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString()); + SetKeys(); shortcutDialog.Hide(); } @@ -462,9 +456,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls var empty = new HotkeySettings(); HotkeySettings = empty; - - PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList(); - AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString()); + SetKeys(); shortcutDialog.Hide(); } @@ -525,5 +517,22 @@ namespace Microsoft.PowerToys.Settings.UI.Controls Dispose(disposing: true); GC.SuppressFinalize(this); } + + private void SetKeys() + { + var keys = HotkeySettings.GetKeysList(); + + if (keys != null && keys.Count > 0) + { + VisualStateManager.GoToState(this, "Configured", true); + PreviewKeysControl.ItemsSource = keys; + AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString()); + } + else + { + VisualStateManager.GoToState(this, "Normal", true); + AutomationProperties.SetHelpText(EditButton, resourceLoader.GetString("ConfigureShortcut")); + } + } } } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml index 6f2f186fb6..af79b39ac7 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml @@ -34,12 +34,16 @@ + IsTabStop="False" + Style="{StaticResource AccentKeyVisualStyle}" /> @@ -51,14 +55,12 @@ Orientation="Vertical" Spacing="8"> - - - - + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 0df37f062f..6709b19b6c 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -42,18 +42,16 @@ ItemsSource="{x:Bind Shortcut, Mode=OneWay}"> - + @@ -130,11 +128,11 @@ Grid.Column="1" VerticalAlignment="Center" Orientation="Vertical"> - + + Text="{x:Bind ViewModel.PowerToysVersion, Mode=OneWay}" /> @@ -143,8 +141,8 @@ Grid.Column="1" Orientation="Horizontal" Spacing="16"> + @@ -163,28 +161,74 @@ Text="2 conflicts found" /> - - --> + + + + + + + + + + + + + + + + + + + + + + + @@ -302,9 +346,6 @@ Padding="0" VerticalAlignment="Top" DividerVisibility="Collapsed"> - - - diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml index 7ac704ae76..e15c5dab9b 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml @@ -25,11 +25,18 @@ - + - + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml index 52363693b9..34abbe993d 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Card.xaml @@ -31,10 +31,10 @@ - - - - - @@ -111,7 +102,7 @@ MaxWidth="{StaticResource PageMaxWidth}" AutomationProperties.Name="{x:Bind SecondaryLinksHeader}" Orientation="Vertical" - Visibility="{x:Bind SecondaryLinks.Count, Converter={StaticResource doubleToVisibilityConverter}}"> + Visibility="{x:Bind SecondaryLinks.Count, Converter={StaticResource DoubleToVisibilityConverter}}"> - - - - - @@ -89,7 +81,7 @@ VerticalAlignment="Center" FontSize="16" Glyph="" - Visibility="{x:Bind IsLocked, Converter={StaticResource BoolToInvertedVisibilityConverter}, ConverterParameter=True, Mode=OneWay}"> + Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True, Mode=OneWay}"> diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml index 67d8030b16..9d04b0915d 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml @@ -21,7 +21,6 @@ - diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/CmdNotFoundPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/CmdNotFoundPage.xaml index 5c4a09a9c4..34305e3529 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/CmdNotFoundPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/CmdNotFoundPage.xaml @@ -10,13 +10,6 @@ xmlns:ui="using:CommunityToolkit.WinUI" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> - - - - diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/ColorPickerPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/ColorPickerPage.xaml index 3d95a5c724..72c388ea58 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/ColorPickerPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/ColorPickerPage.xaml @@ -14,14 +14,8 @@ d:DataContext="{d:DesignInstance Type=viewmodels:ColorPickerViewModel}" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> - - - - - - - - - - - - @@ -52,6 +43,7 @@ AutomationProperties.AccessibilityView="Raw" Content="{Binding}" FontSize="12" + Foreground="{ThemeResource TextFillColorSecondaryBrush}" IsTabStop="False" /> @@ -114,14 +106,16 @@ Padding="0,0,8,0" Click="WhatsNewButton_Click" Style="{StaticResource SubtleButtonStyle}"> - - + - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml.cs new file mode 100644 index 0000000000..36a20fd340 --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml.cs @@ -0,0 +1,30 @@ +// 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.PowerToys.Settings.UI.Library; +using Microsoft.PowerToys.Settings.UI.Services; +using Microsoft.PowerToys.Settings.UI.Views; +using Microsoft.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class CheckUpdateControl : UserControl + { + public bool UpdateAvailable { get; set; } + + public UpdatingSettings UpdateSettingsConfig { get; set; } + + public CheckUpdateControl() + { + InitializeComponent(); + UpdateSettingsConfig = UpdatingSettings.LoadSettings(); + UpdateAvailable = UpdateSettingsConfig != null && (UpdateSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || UpdateSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload); + } + + private void SWVersionButtonClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) + { + NavigationService.Navigate(typeof(GeneralPage)); + } + } +} diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictControl.xaml new file mode 100644 index 0000000000..ed3e153682 --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictControl.xaml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictControl.xaml.cs new file mode 100644 index 0000000000..9b0c0f4574 --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/ShortcutConflictControl.xaml.cs @@ -0,0 +1,40 @@ +// 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 System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using Windows.Foundation; +using Windows.Foundation.Collections; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class ShortcutConflictControl : UserControl + { + public ShortcutConflictControl() + { + InitializeComponent(); + GetShortcutConflicts(); + } + + private void GetShortcutConflicts() + { + // TO DO: Implement the logic to retrieve and display shortcut conflicts. Make sure to Collapse this control if not conflicts are found. + } + + private void ShortcutConflictBtn_Click(object sender, RoutedEventArgs e) + { + // TO DO: Handle the button click event to show the shortcut conflicts window. + } + } +} diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 1b240cdaed..1539a3be17 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -135,96 +135,8 @@ Grid.Column="1" Orientation="Horizontal" Spacing="16"> - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -301,7 +213,6 @@ Foreground="{ThemeResource TextFillColorSecondaryBrush}" Visibility="{x:Bind ViewModel.ActionModules.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" /> - - _settingsRepository; private GeneralSettings generalSettingsConfig; private Windows.ApplicationModel.Resources.ResourceLoader resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader; @@ -68,9 +64,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } GetShortcutModules(); - - UpdateSettingsConfig = UpdatingSettings.LoadSettings(); - UpdateAvailable = UpdateSettingsConfig != null && (UpdateSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || UpdateSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload); } private void AddDashboardListItem(ModuleType moduleType) From d1e702cf9b5b8d15a3fcf589a438994f2745f3ad Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Tue, 1 Jul 2025 11:36:53 +0200 Subject: [PATCH 16/24] Fix --- src/settings-ui/Settings.UI/PowerToys.Settings.csproj | 4 ++++ .../SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj index 1a4791df34..1c9cc28ff6 100644 --- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj +++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj @@ -23,6 +23,7 @@ + @@ -133,6 +134,9 @@ Always + + MSBuild:Compile + MSBuild:Compile diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml index 267ecd2076..f09ee00aef 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml @@ -12,7 +12,7 @@ From 2dcf2020f5ff3d36f7bef9c967192458c079b903 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Tue, 1 Jul 2025 11:58:48 +0200 Subject: [PATCH 18/24] Styles refactor --- .../SettingsXAML/Controls/KeyVisual.xaml | 92 ++++++++++--------- .../ShortcutControl/ShortcutControl.xaml | 1 + 2 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml index 8c93708d46..5541551e71 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/KeyVisual.xaml @@ -16,7 +16,8 @@ - + + @@ -24,8 +25,8 @@ - - + Content="{TemplateBinding Content}" + CornerRadius="{TemplateBinding CornerRadius}" + FontSize="{TemplateBinding FontSize}" + FontWeight="{TemplateBinding FontWeight}" + Foreground="{TemplateBinding Foreground}" + TextLineBounds="Tight"> + + + @@ -66,13 +68,12 @@ - + - - \ No newline at end of file + From e1654796547aab0f1f43301f65091fbdcd432294 Mon Sep 17 00:00:00 2001 From: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com> Date: Mon, 14 Jul 2025 14:34:20 -0400 Subject: [PATCH 24/24] Fixed a few accessibility issues. Improper name fields and such --- .../Settings.UI.Library/HotkeySettings.cs | 2 +- .../Dashboard/CheckUpdateControl.xaml | 2 +- .../SettingsXAML/Flyout/LaunchPage.xaml | 2 +- .../SettingsXAML/Views/DashboardPage.xaml | 438 +++++++++--------- 4 files changed, 223 insertions(+), 221 deletions(-) diff --git a/src/settings-ui/Settings.UI.Library/HotkeySettings.cs b/src/settings-ui/Settings.UI.Library/HotkeySettings.cs index 89c1a1995d..3a225fc4d5 100644 --- a/src/settings-ui/Settings.UI.Library/HotkeySettings.cs +++ b/src/settings-ui/Settings.UI.Library/HotkeySettings.cs @@ -120,7 +120,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library if (Shift) { - shortcutList.Add(16); // The Shift key or button. + shortcutList.Add("Shift"); // We used to have 16 which is the shift key button. But this broke accessibility, setting broken unicode to an automation name in KeyVisual. } if (Code > 0) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml index f09ee00aef..38b79c31e6 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/Dashboard/CheckUpdateControl.xaml @@ -35,7 +35,7 @@ Glyph="" /> - + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml index 9d04b0915d..a5e6f2de40 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml @@ -109,7 +109,7 @@ diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 1539a3be17..b892cbaa8d 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -14,226 +14,227 @@ DataContext="DashboardViewModel" mc:Ignorable="d"> - - + - - - - - - - + + + + + + - - - - - - - - + + + + + + + - - - - + + + - - + + - - - - - - - + + + + + + - - - - + + + - - - - - - + + + + + + - - - - - - - - - - - - + + + - - - - + + + + - - - - + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - + - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + - - - + + - - - - - - - + + + + + - - 0 - 16 - - - - - + 0 + 16 + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - + OffContent="" + OnContent="" + AutomationProperties.Name="{x:Bind Label}" /> + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file