mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
* Add Settings.WinUI3 project * New namespace * Activation and Services * Assets and Behaviors * Converters and Helpers * Controls * View and ViewModels * Styles and Themes * OOBE * Strings * Small App moves * [check] Project files - publish profiles and launchSettings.json * [using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name workaround * [WIP] Workarounds to make it work * Fix suppressed warnings - naming * Add code analysis * Fix KBMPage and App dispatcher Fix MessageBox - replace with MessageDialog * Fix ImageResizerPage & mark ColorPickerButton with TODO * Add icon to windows Cleanup MainWindow.xaml.cs and OobeWindow.xaml.cs MainWindows and OobeWindow management * App Icon No framework and runtime subdirs * Remove PowerToys.Settings and Settings.UI from solution Update output paths * Installer work & publish.cmd * Fix dispatcher crashes * Fix crashes * Add all dlls to installer Cleanup installer Add OpenOOBE and OpenScoobe logic Fix minor issues Fix update scenario - REINSTALLMODE * Rename back namespaces, project name and project dir * [wip] move to winappsdk 1.1 * Fix propagating isElevated & installer runtimes dlls * Remove obsolete dir/file * PowerToys.Interop to netstandard2.0 * Move everything to .Net6 * [Settings] Always launch settings process non-elevated (#17791) * Move back to WinAppSdk 1.0.1 * Add Settings.WinUI3 project * New namespace * Activation and Services * Assets and Behaviors * Converters and Helpers * Controls * View and ViewModels * Styles and Themes * OOBE * Strings * Small App moves * [check] Project files - publish profiles and launchSettings.json * [using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name workaround * [WIP] Workarounds to make it work * Fix suppressed warnings - naming * Add code analysis * Fix KBMPage and App dispatcher Fix MessageBox - replace with MessageDialog * Fix ImageResizerPage & mark ColorPickerButton with TODO * Add icon to windows Cleanup MainWindow.xaml.cs and OobeWindow.xaml.cs MainWindows and OobeWindow management * App Icon No framework and runtime subdirs * Remove PowerToys.Settings and Settings.UI from solution Update output paths * Installer work & publish.cmd * Fix dispatcher crashes * Fix crashes * Add all dlls to installer Cleanup installer Add OpenOOBE and OpenScoobe logic Fix minor issues Fix update scenario - REINSTALLMODE * Rename back namespaces, project name and project dir * [wip] move to winappsdk 1.1 * Fix propagating isElevated & installer runtimes dlls * Remove obsolete dir/file * PowerToys.Interop to netstandard2.0 * Move everything to .Net6 * [Settings] Always launch settings process non-elevated (#17791) * Move back to WinAppSdk 1.0.1 * Revert merge conflict ARM64 removal * Fix KBM Browse overlay image button * Bring back settings publish profile * Update release.yml * Change target frameworkd windows version * [Setup] Add Windows Application Runtime SDK (#17809) * Update requirements doc * Update compiling docs * Fix signing * Fix Settings exe and dll versions * Add exception for dlls that have version 1.0.0.0 * Fix powershell condition Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
// 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.ComponentModel;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Automation;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Controls
|
|
{
|
|
public class CheckBoxWithDescriptionControl : CheckBox
|
|
{
|
|
private CheckBoxWithDescriptionControl _checkBoxSubTextControl;
|
|
|
|
public CheckBoxWithDescriptionControl()
|
|
{
|
|
_checkBoxSubTextControl = (CheckBoxWithDescriptionControl)this;
|
|
this.Loaded += CheckBoxSubTextControl_Loaded;
|
|
}
|
|
|
|
protected override void OnApplyTemplate()
|
|
{
|
|
Update();
|
|
base.OnApplyTemplate();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!string.IsNullOrEmpty(Header))
|
|
{
|
|
AutomationProperties.SetName(this, Header);
|
|
}
|
|
}
|
|
|
|
private void CheckBoxSubTextControl_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
StackPanel panel = new StackPanel() { Orientation = Orientation.Vertical };
|
|
|
|
// 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;
|
|
}
|
|
|
|
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
|
|
"Header",
|
|
typeof(string),
|
|
typeof(CheckBoxWithDescriptionControl),
|
|
new PropertyMetadata(default(string)));
|
|
|
|
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(
|
|
"Description",
|
|
typeof(object),
|
|
typeof(CheckBoxWithDescriptionControl),
|
|
new PropertyMetadata(default(string)));
|
|
|
|
[Localizable(true)]
|
|
public string Header
|
|
{
|
|
get => (string)GetValue(HeaderProperty);
|
|
set => SetValue(HeaderProperty, value);
|
|
}
|
|
|
|
[Localizable(true)]
|
|
public string Description
|
|
{
|
|
get => (string)GetValue(DescriptionProperty);
|
|
set => SetValue(DescriptionProperty, value);
|
|
}
|
|
}
|
|
}
|