From f7333c89bb0d69b446382eb508a698d8cd062542 Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Tue, 31 Aug 2021 18:23:00 +0300 Subject: [PATCH] [FancyZones][Settings] "Allow zones to span across monitors" prerequisites description. (#12913) --- .../Controls/TextBlockControl.xaml | 15 ++++ .../Controls/TextBlockControl.xaml.cs | 76 +++++++++++++++++++ .../Microsoft.PowerToys.Settings.UI.csproj | 7 ++ .../Strings/en-us/Resources.resw | 7 +- .../Views/FancyZonesPage.xaml | 19 ++++- 5 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml.cs diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml new file mode 100644 index 000000000..7733a34b3 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml @@ -0,0 +1,15 @@ + + + + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml.cs new file mode 100644 index 000000000..66f89bbde --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Controls/TextBlockControl.xaml.cs @@ -0,0 +1,76 @@ +// 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 Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class TextBlockControl : UserControl + { + public static readonly DependencyProperty TextProperty = DependencyProperty.Register( + "Text", + typeof(string), + typeof(TextBlockControl), + null); + + [Localizable(true)] + public string Text + { + get => (string)GetValue(TextProperty); + set => SetValue(TextProperty, value); + } + + public static readonly DependencyProperty EnabledForegroundProperty = DependencyProperty.Register( + "EnabledForeground", + typeof(Brush), + typeof(TextBlockControl), + null); + + public Brush EnabledForeground + { + get => (Brush)GetValue(EnabledForegroundProperty); + set => SetValue(EnabledForegroundProperty, value); + } + + public static readonly DependencyProperty DisabledForegroundProperty = DependencyProperty.Register( + "DisabledForeground", + typeof(Brush), + typeof(TextBlockControl), + null); + + public Brush DisabledForeground + { + get => (Brush)GetValue(DisabledForegroundProperty); + set => SetValue(DisabledForegroundProperty, value); + } + + public TextBlockControl() + { + this.InitializeComponent(); + DataContext = this; + + IsEnabledChanged += TextBlockControl_IsEnabledChanged; + } + + private void TextBlockControl_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if ((bool)e.NewValue) + { + textBlock.Foreground = EnabledForeground; + } + else + { + textBlock.Foreground = DisabledForeground; + } + } + + private void TextBlock_Loaded(object sender, RoutedEventArgs e) + { + textBlock.Foreground = IsEnabled ? EnabledForeground : DisabledForeground; + } + } +} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj index c27ecd9e1..64c8f7edc 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj @@ -115,6 +115,9 @@ OOBEPageControl.xaml + + TextBlockControl.xaml + @@ -334,6 +337,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer 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 6de227fb0..511e64ad6 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 @@ -880,8 +880,8 @@ Made with 💗 by Microsoft and the PowerToys community. Windows refers to the OS - - Allow zones to span across monitors (all monitors must have the same DPI scaling) + + Allow zones to span across monitors Actual height @@ -1574,4 +1574,7 @@ From there, simply click on a Markdown file or SVG icon in the File Explorer and Remove + + All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors. + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml index 53053ea49..f8c498836 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml @@ -1,4 +1,4 @@ - - + @@ -87,8 +87,19 @@ - - + + + + + + +