From 4e833cc521c1b2d60bb174ae8628fb7c94c22353 Mon Sep 17 00:00:00 2001 From: punker76 Date: Fri, 15 Jul 2022 23:14:13 +0200 Subject: [PATCH] feat: #3209 #3328 add win10 and fluent TextBox styles - Add new attached property ControlsHelper.DisabledBorderBrush - Add new TextBox style values - TextControlBorderThemeThickness - TextControlThemePadding - TextControlBorderThemeThicknessFocused - TextControlPlaceholderMargin - Add new Win10 style: MahApps.Styles.TextBox.Win10 - Add new Fluent style: MahApps.Styles.TextBox.Fluent - Add new brushes: - MahApps.Brushes.TextControl.Background - MahApps.Brushes.TextControl.BackgroundPointerOver - MahApps.Brushes.TextControl.BackgroundFocused - MahApps.Brushes.TextControl.BackgroundDisabled - MahApps.Brushes.TextControl.BorderBrush - MahApps.Brushes.TextControl.BorderBrushPointerOver - MahApps.Brushes.TextControl.BorderBrushFocused - MahApps.Brushes.TextControl.BorderBrushDisabled - MahApps.Brushes.TextControl.Foreground - MahApps.Brushes.TextControl.ForegroundPointerOver - MahApps.Brushes.TextControl.ForegroundFocused - MahApps.Brushes.TextControl.ForegroundDisabled - MahApps.Brushes.TextControl.PlaceholderForeground - MahApps.Brushes.TextControl.PlaceholderForegroundPointerOver - MahApps.Brushes.TextControl.PlaceholderForegroundFocused - MahApps.Brushes.TextControl.PlaceholderForegroundDisabled - MahApps.Brushes.TextControl.HeaderForeground - MahApps.Brushes.TextControl.HeaderForegroundDisabled - MahApps.Brushes.TextControl.SelectionHighlightColor - MahApps.Brushes.TextControl.ButtonBackground - MahApps.Brushes.TextControl.ButtonBackgroundPointerOver - MahApps.Brushes.TextControl.ButtonBackgroundPressed - MahApps.Brushes.TextControl.ButtonBorderBrush - MahApps.Brushes.TextControl.ButtonBorderBrushPointerOver - MahApps.Brushes.TextControl.ButtonBorderBrushPressed - MahApps.Brushes.TextControl.ButtonForeground - MahApps.Brushes.TextControl.ButtonForegroundPointerOver - MahApps.Brushes.TextControl.ButtonForegroundPressed BREAKING CHANGE: change background for dark theme Change the dark theme background from #FF252525 to #FF141414. --- .../Controls/Helper/ControlsHelper.cs | 37 +++ .../Styles/Controls.TextBox.xaml | 314 +++++++++++++++++- .../Styles/Themes/GeneratorParameters.json | 4 +- .../Styles/Themes/Theme.Template.xaml | 30 ++ 4 files changed, 370 insertions(+), 15 deletions(-) diff --git a/src/MahApps.Metro/Controls/Helper/ControlsHelper.cs b/src/MahApps.Metro/Controls/Helper/ControlsHelper.cs index 6ef7d93ca6..0eb25e7df0 100644 --- a/src/MahApps.Metro/Controls/Helper/ControlsHelper.cs +++ b/src/MahApps.Metro/Controls/Helper/ControlsHelper.cs @@ -221,6 +221,43 @@ public static void SetMouseOverBorderBrush(DependencyObject obj, Brush value) obj.SetValue(MouseOverBorderBrushProperty, value); } + public static readonly DependencyProperty DisabledBorderBrushProperty + = DependencyProperty.RegisterAttached( + "DisabledBorderBrush", + typeof(Brush), + typeof(ControlsHelper), + new FrameworkPropertyMetadata(Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits)); + + /// + /// Gets the brush used to draw the disabled border brush. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(TextBox))] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] + [AttachedPropertyBrowsableForType(typeof(RadioButton))] + [AttachedPropertyBrowsableForType(typeof(DatePicker))] + [AttachedPropertyBrowsableForType(typeof(ComboBox))] + [AttachedPropertyBrowsableForType(typeof(Tile))] + public static Brush GetDisabledBorderBrush(DependencyObject obj) + { + return (Brush)obj.GetValue(DisabledBorderBrushProperty); + } + + /// + /// Sets the brush used to draw the disabled border brush. + /// + [Category(AppName.MahApps)] + [AttachedPropertyBrowsableForType(typeof(TextBox))] + [AttachedPropertyBrowsableForType(typeof(CheckBox))] + [AttachedPropertyBrowsableForType(typeof(RadioButton))] + [AttachedPropertyBrowsableForType(typeof(DatePicker))] + [AttachedPropertyBrowsableForType(typeof(ComboBox))] + [AttachedPropertyBrowsableForType(typeof(Tile))] + public static void SetDisabledBorderBrush(DependencyObject obj, Brush value) + { + obj.SetValue(DisabledBorderBrushProperty, value); + } + /// /// DependencyProperty for property. /// diff --git a/src/MahApps.Metro/Styles/Controls.TextBox.xaml b/src/MahApps.Metro/Styles/Controls.TextBox.xaml index 9e32884da8..8cf2565c4c 100644 --- a/src/MahApps.Metro/Styles/Controls.TextBox.xaml +++ b/src/MahApps.Metro/Styles/Controls.TextBox.xaml @@ -1,4 +1,4 @@ - @@ -7,18 +7,23 @@ + 1,1,1,1 + 4,4,4,4 + 1,1,1,1 + 4,0,4,0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +