[Settings] Added disabled state to FZ preview control (#15166)

* Added Disabled state

* Added wallpaper image to installer file
This commit is contained in:
Niels Laute
2021-12-27 14:29:31 +01:00
committed by GitHub
parent 226b04e014
commit 7ac7e48e66
6 changed files with 34 additions and 8 deletions

View File

@@ -34,6 +34,11 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
}
}
private void FancyZonesPreviewControl_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SetEnabledState();
}
public bool IsSystemTheme
{
get { return (bool)GetValue(IsSystemThemeProperty); }
@@ -48,7 +53,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
set { SetValue(WallpaperPathProperty, value); }
}
public static readonly DependencyProperty WallpaperPathProperty = DependencyProperty.Register("WallpaperPath", typeof(string), typeof(FancyZonesPreviewControl), new PropertyMetadata("ms-appx:///Assets/wallpaper_placeholder.png"));
public static readonly DependencyProperty WallpaperPathProperty = DependencyProperty.Register("WallpaperPath", typeof(string), typeof(FancyZonesPreviewControl), new PropertyMetadata("ms-appx:///Assets/Modules/Wallpaper.png"));
public Color CustomBorderColor
{
@@ -139,5 +144,17 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
Zone2Number.Foreground = numberBrush;
Zone3Number.Foreground = numberBrush;
}
private void SetEnabledState()
{
VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true);
}
private void FancyZonesPreviewControl_Loaded(object sender, RoutedEventArgs e)
{
IsEnabledChanged -= FancyZonesPreviewControl_IsEnabledChanged;
SetEnabledState();
IsEnabledChanged += FancyZonesPreviewControl_IsEnabledChanged;
}
}
}