[Settings] Run Plugin additional options: description (#17108)

* last changes

* update ww settings

* feedbvack and TimeDate plugin

* Add property description
This commit is contained in:
Heiko
2022-03-21 13:47:09 +01:00
committed by GitHub
parent 4c067bb728
commit 380add882c
10 changed files with 121 additions and 22 deletions

View File

@@ -10,6 +10,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public string DisplayLabel { get; set; }
/// <summary>
/// Gets or sets a value to show a description of this setting in the settings ui. (Optional)
/// </summary>
public string DisplayDescription { get; set; }
public bool Value { get; set; }
}
}

View File

@@ -18,6 +18,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
public string DisplayLabel { get => _additionalOption.DisplayLabel; }
public string DisplayDescription { get => _additionalOption.DisplayDescription; }
public bool Value
{
get => _additionalOption.Value;

View File

@@ -38,8 +38,18 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
private void CheckBoxSubTextControl_Loaded(object sender, RoutedEventArgs e)
{
StackPanel panel = new StackPanel() { Orientation = Orientation.Vertical };
panel.Children.Add(new TextBlock() { Margin = new Thickness(0, 10, 0, 0), Text = Header });
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)App.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });
// Add text box only if the description is not empty. Required for additional plugin options.
if (!string.IsNullOrWhiteSpace(Description))
{
panel.Children.Add(new TextBlock() { Margin = new Thickness(0, 10, 0, 0), Text = Header });
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)App.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });
}
else
{
panel.Children.Add(new TextBlock() { Margin = new Thickness(0, 0, 0, 0), Text = Header });
}
_checkBoxSubTextControl.Content = panel;
}

View File

@@ -253,7 +253,7 @@
<DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel">
<StackPanel Orientation="Vertical">
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox Content="{x:Bind Path=DisplayLabel}"
<controls:CheckBoxWithDescriptionControl Header="{x:Bind Path=DisplayLabel}" Description="{x:Bind Path=DisplayDescription}"
IsChecked="{x:Bind Path=Value, Mode=TwoWay}"
Margin="{StaticResource ExpanderSettingMargin}"/>
</StackPanel>