diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs index 3661c86e94..222922e87d 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.cs @@ -19,13 +19,25 @@ namespace Microsoft.PowerToys.Settings.UI.Controls /// [TemplateVisualState(Name = "Normal", GroupName = "CommonStates")] [TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")] + [TemplatePart(Name = PartDescriptionPresenter, Type = typeof(ContentPresenter))] public partial class SettingsGroup : ItemsControl { + private const string PartDescriptionPresenter = "DescriptionPresenter"; + private ContentPresenter _descriptionPresenter; + private SettingsGroup _settingsGroup; + public SettingsGroup() { DefaultStyleKey = typeof(SettingsGroup); } + [Localizable(true)] + public string Header + { + get => (string)GetValue(HeaderProperty); + set => SetValue(HeaderProperty, value); + } + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( "Header", typeof(string), @@ -33,20 +45,33 @@ namespace Microsoft.PowerToys.Settings.UI.Controls new PropertyMetadata(default(string))); [Localizable(true)] - public string Header + public object Description { - get => (string)GetValue(HeaderProperty); - set => SetValue(HeaderProperty, value); + get => (object)GetValue(DescriptionProperty); + set => SetValue(DescriptionProperty, value); } + public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register( + "Description", + typeof(object), + typeof(SettingsGroup), + new PropertyMetadata(null, OnDescriptionChanged)); + protected override void OnApplyTemplate() { IsEnabledChanged -= SettingsGroup_IsEnabledChanged; + _settingsGroup = (SettingsGroup)this; + _descriptionPresenter = (ContentPresenter)_settingsGroup.GetTemplateChild(PartDescriptionPresenter); SetEnabledState(); IsEnabledChanged += SettingsGroup_IsEnabledChanged; base.OnApplyTemplate(); } + private static void OnDescriptionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ((SettingsGroup)d).Update(); + } + private void SettingsGroup_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { SetEnabledState(); @@ -57,6 +82,23 @@ namespace Microsoft.PowerToys.Settings.UI.Controls VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true); } + private void Update() + { + if (_settingsGroup == null) + { + return; + } + + if (_settingsGroup.Description == null) + { + _settingsGroup._descriptionPresenter.Visibility = Visibility.Collapsed; + } + else + { + _settingsGroup._descriptionPresenter.Visibility = Visibility.Visible; + } + } + protected override AutomationPeer OnCreateAutomationPeer() { return new SettingsGroupAutomationPeer(this); diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml index 9167346f49..f594a918e3 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/SettingsGroup/SettingsGroup.xaml @@ -25,6 +25,7 @@ + @@ -32,14 +33,36 @@ + - + + + + + + + + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index 9e52d1d9b7..16e2b86769 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -190,6 +190,9 @@ Camera + + To use this feature, make sure to select PowerToys VideoConference Mute as your camera source in your apps. + Microphone @@ -993,18 +996,19 @@ Made with 💗 by Microsoft and the PowerToys community. Icon Preview - + Preview Pane + + Ensure that Preview Pane is open by toggling the view with Alt + P in File Explorer. + Preview Pane and File Explorer are app/feature names in Windows. 'Alt + P' is a shortcut + You need to run as administrator to modify these settings. The settings on this page affect all users on the system - - Please ensure that Preview Pane is open by toggling the view with Alt + P in File Explorer - A reboot may be required for changes to these settings to take effect @@ -1724,13 +1728,13 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex Find My Mouse Refers to the utility name + + Find My Mouse highlights the position of the cursor when pressing the left Ctrl key twice. + "Ctrl" is a keyboard key. "Find My Mouse" is the name of the utility + Enable Find My Mouse "Find My Mouse" is the name of the utility. - - - Find My Mouse highlights the position of the cursor when pressing the left Ctrl key twice. - "Ctrl" is a keyboard key. "Find My Mouse" is the name of the utility Do not activate when Game Mode is on @@ -1764,22 +1768,22 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex Mouse Highlighter Refers to the utility name + + Mouse Highlighter mode will highlight mouse clicks. + "Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse. + Enable Mouse Highlighter "Find My Mouse" is the name of the utility. - - Mouse Highlighter mode will highlight mouse clicks. - "Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse. - - + Activation shortcut - + Customize the shortcut to turn on or off this mode "Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse. - + Left button highlight color diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/MouseUtilsPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/MouseUtilsPage.xaml index f1e5f59d39..002e76046b 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/MouseUtilsPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/MouseUtilsPage.xaml @@ -14,7 +14,6 @@ - @@ -89,7 +88,6 @@ - diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml index 10c9e4e23a..3e4bae6f8c 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml @@ -34,8 +34,7 @@ IsClosable="False" /> - - +