From a10dcf15e253a2d0340404cdb84d75afa5c01895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=AB=E5=9F=8Evia?= Date: Wed, 22 Mar 2023 10:16:14 +0800 Subject: [PATCH] 1.1.8.5 (#154) * 1.1.8.5 --- Samples/Views/MainView.xaml | 1 - Samples/Views/MainView.xaml.cs | 1 + .../Helpers/VisualStateHelper.cs | 321 +++++++++++++----- .../Resources/StyleKeys.cs | 2 + .../Styles/CheckBoxStyle.xaml | 60 ++++ .../Styles/ComboBoxItemStyle.xaml | 10 +- .../Styles/ContextMenuStyle.xaml | 34 +- .../Styles/DataGridStyle.xaml | 4 + .../Styles/MenuItemStyle.xaml | 189 +++++++++-- .../Styles/MenuStyle.xaml | 4 + .../Styles/RadioButtonStyle.xaml | 51 ++- .../Styles/SwitchStyle.xaml | 73 ++++ .../Templates/CheckBoxTemplate.xaml | 32 +- .../Templates/ComboBoxItemTemplate.xaml | 79 +++-- .../Templates/MenuItemTemplate.xaml | 63 +++- .../Templates/RadioButtonTemplate.xaml | 81 +++-- .../Templates/SwitchTemplate.xaml | 99 +++--- .../Templates/ToggleButtonTemplate.xaml | 95 +++--- .../Utils/AnimationUtil.cs | 23 +- .../Panuon.WPF.UI/Controls/Carousel.cs | 1 - .../Panuon.WPF.UI/Controls/Switch.cs | 219 +++++++++--- .../Panuon.WPF.UI/Controls/ThumbFence.cs | 2 +- .../Panuon.WPF.UI/Helpers/CheckBoxHelper.cs | 92 ++++- .../Panuon.WPF.UI/Helpers/ComboBoxHelper.cs | 45 +++ .../Helpers/ComboBoxItemHelper.cs | 47 ++- .../Helpers/ContextMenuHelper.cs | 105 ++++++ .../Panuon.WPF.UI/Helpers/MenuHelper.cs | 240 +++++++++++++ .../Panuon.WPF.UI/Helpers/MenuItemHelper.cs | 105 ++++++ .../Helpers/RadioButtonHelper.cs | 58 ++++ .../Helpers/ScrollViewerHelper.cs | 9 +- .../Helpers/ToggleButtonHelper.cs | 18 +- .../Panuon.WPF.UI/Properties/AssemblyInfo.cs | 4 +- 32 files changed, 1817 insertions(+), 350 deletions(-) diff --git a/Samples/Views/MainView.xaml b/Samples/Views/MainView.xaml index 8aebd39e..ab9dab65 100644 --- a/Samples/Views/MainView.xaml +++ b/Samples/Views/MainView.xaml @@ -6,7 +6,6 @@ xmlns:local="clr-namespace:Samples.Views" xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" xmlns:purs="clr-namespace:Panuon.WPF.UI.Resources;assembly=Panuon.WPF.UI" - xmlns:i="clr-namespace:Panuon.WPF.UI.Internal;assembly=Panuon.WPF.UI" mc:Ignorable="d" Title="MainView" Height="600" diff --git a/Samples/Views/MainView.xaml.cs b/Samples/Views/MainView.xaml.cs index a24a7d49..9caec62b 100644 --- a/Samples/Views/MainView.xaml.cs +++ b/Samples/Views/MainView.xaml.cs @@ -36,6 +36,7 @@ public MainView() { InitExampleItems(); })); + } #endregion diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Helpers/VisualStateHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Helpers/VisualStateHelper.cs index 0d9ea422..46331b7a 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Helpers/VisualStateHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Helpers/VisualStateHelper.cs @@ -137,6 +137,36 @@ public static void SetGlyphBrush(Control control, Brush value) DependencyProperty.RegisterAttached("GlyphBrush", typeof(Brush), typeof(VisualStateHelper)); #endregion + #region ToggleSize + public static double GetToggleSize(DependencyObject obj) + { + return (double)obj.GetValue(ToggleSizeProperty); + } + + public static void SetToggleSize(DependencyObject obj, double value) + { + obj.SetValue(ToggleSizeProperty, value); + } + + public static readonly DependencyProperty ToggleSizeProperty = + DependencyProperty.RegisterAttached("ToggleSize", typeof(double), typeof(VisualStateHelper)); + #endregion + + #region ToggleCornerRadius + public static CornerRadius GetToggleCornerRadius(DependencyObject obj) + { + return (CornerRadius)obj.GetValue(ToggleCornerRadiusProperty); + } + + public static void SetToggleCornerRadius(DependencyObject obj, CornerRadius value) + { + obj.SetValue(ToggleCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ToggleCornerRadiusProperty = + DependencyProperty.RegisterAttached("ToggleCornerRadius", typeof(CornerRadius), typeof(VisualStateHelper)); + #endregion + #region ToggleBrush public static Brush GetToggleBrush(Control control) { @@ -182,6 +212,21 @@ public static void SetEffect(DependencyObject obj, DropShadowEffect value) DependencyProperty.RegisterAttached("Effect", typeof(DropShadowEffect), typeof(VisualStateHelper)); #endregion + #region ToggleEffect + public static DropShadowEffect GetToggleEffect(DependencyObject obj) + { + return (DropShadowEffect)obj.GetValue(ToggleEffectProperty); + } + + public static void SetToggleEffect(DependencyObject obj, DropShadowEffect value) + { + obj.SetValue(ToggleEffectProperty, value); + } + + public static readonly DependencyProperty ToggleEffectProperty = + DependencyProperty.RegisterAttached("ToggleEffect", typeof(DropShadowEffect), typeof(VisualStateHelper)); + #endregion + #region Percent public static double GetPercent(DependencyObject obj) { @@ -228,59 +273,43 @@ public static void SetIsClickEffectPressed(DependencyObject obj, bool value) #endregion - #endregion #region ShadowColor Properties - #region ShadowColor public static readonly DependencyProperty ShadowColorProperty = DependencyProperty.RegisterAttached("ShadowColor", typeof(Color?), typeof(VisualStateHelper)); - #endregion + + public static readonly DependencyProperty ToggleShadowColorProperty = + DependencyProperty.RegisterAttached("ToggleShadowColor", typeof(Color?), typeof(VisualStateHelper)); #endregion #region Hover Properties - #region HoverCornerRadiusProperty public static readonly DependencyProperty HoverCornerRadiusProperty = DependencyProperty.RegisterAttached("HoverCornerRadius", typeof(CornerRadius?), typeof(VisualStateHelper)); - #endregion - #region HoverBorderBrushProperty public static readonly DependencyProperty HoverBorderBrushProperty = DependencyProperty.RegisterAttached("HoverBorderBrush", typeof(Brush), typeof(VisualStateHelper)); - #endregion - #region HoverBorderThicknessProperty public static readonly DependencyProperty HoverBorderThicknessProperty = DependencyProperty.RegisterAttached("HoverBorderThickness", typeof(Thickness?), typeof(VisualStateHelper)); - #endregion - #region HoverBackgroundProperty public static readonly DependencyProperty HoverBackgroundProperty = DependencyProperty.RegisterAttached("HoverBackground", typeof(Brush), typeof(VisualStateHelper)); - #endregion - #region HoverForegroundProperty public static readonly DependencyProperty HoverForegroundProperty = DependencyProperty.RegisterAttached("HoverForeground", typeof(Brush), typeof(VisualStateHelper)); - #endregion - #region HoverGlyphBrushProperty public static readonly DependencyProperty HoverGlyphBrushProperty = DependencyProperty.RegisterAttached("HoverGlyphBrush", typeof(Brush), typeof(VisualStateHelper)); - #endregion - - #region HoverToggleBrushProperty + public static readonly DependencyProperty HoverToggleBrushProperty = DependencyProperty.RegisterAttached("HoverToggleBrush", typeof(Brush), typeof(VisualStateHelper)); - #endregion - #region HoverRibbonLineBrushProperty public static readonly DependencyProperty HoverRibbonLineBrushProperty = DependencyProperty.RegisterAttached("HoverRibbonLineBrush", typeof(Brush), typeof(VisualStateHelper)); - #endregion #region HoverBorderBrushLock public static bool GetHoverBorderBrushLock(DependencyObject obj) @@ -388,11 +417,17 @@ public static void SetIsHover(DependencyObject obj, bool value) DependencyProperty.RegisterAttached("IsHover", typeof(bool), typeof(VisualStateHelper), new PropertyMetadata(OnIsHoverChanged)); #endregion - #region HoverShadowColor public static readonly DependencyProperty HoverShadowColorProperty = DependencyProperty.RegisterAttached("HoverShadowColor", typeof(Color?), typeof(VisualStateHelper)); - #endregion + public static readonly DependencyProperty HoverToggleSizeProperty = + DependencyProperty.RegisterAttached("HoverToggleSize", typeof(double?), typeof(VisualStateHelper)); + + public static readonly DependencyProperty HoverToggleCornerRadiusProperty = + DependencyProperty.RegisterAttached("HoverToggleCornerRadius", typeof(CornerRadius?), typeof(VisualStateHelper)); + + public static readonly DependencyProperty HoverToggleShadowColorProperty = + DependencyProperty.RegisterAttached("HoverToggleShadowColor", typeof(Color?), typeof(VisualStateHelper)); #endregion #region Focused Properties @@ -475,10 +510,11 @@ public static void SetIsSelected(DependencyObject obj, bool value) #region CheckedProperty - #region SelectedShadowColor public static readonly DependencyProperty CheckedShadowColorProperty = DependencyProperty.RegisterAttached("CheckedShadowColor", typeof(Color?), typeof(VisualStateHelper), new PropertyMetadata(OnCheckedShadowColorChanged)); - #endregion + + public static readonly DependencyProperty CheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("CheckedCornerRadius", typeof(CornerRadius?), typeof(VisualStateHelper)); #region IsChecked public static bool? GetIsChecked(DependencyObject obj) @@ -539,6 +575,18 @@ private static void OnRegistChanged(DependencyObject d, DependencyPropertyChange effectBinding.Bindings.Add(CreateBinding(ShadowHelper.OpacityProperty)); effectBinding.Bindings.Add(CreateBinding(ShadowHelper.RenderingBiasProperty)); element.SetBinding(EffectProperty, effectBinding); + + var toggleEffectBinding = new MultiBinding() + { + Converter = new DropShadowEffectWithDepthConverter(), + }; + toggleEffectBinding.Bindings.Add(CreateBinding(ToggleShadowColorProperty)); + toggleEffectBinding.Bindings.Add(CreateBinding(ShadowHelper.BlurRadiusProperty)); + toggleEffectBinding.Bindings.Add(CreateBinding(ShadowHelper.ShadowDepthProperty)); + toggleEffectBinding.Bindings.Add(CreateBinding(ShadowHelper.DirectionProperty)); + toggleEffectBinding.Bindings.Add(CreateBinding(ShadowHelper.OpacityProperty)); + toggleEffectBinding.Bindings.Add(CreateBinding(ShadowHelper.RenderingBiasProperty)); + element.SetBinding(ToggleEffectProperty, toggleEffectBinding); } private static void OnHoverLockChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) @@ -660,62 +708,6 @@ private static void OnIsClickEffectPressedChanged(DependencyObject d, Dependency storyboard.Begin(); } - private static void Element_Unchecked(object sender, RoutedEventArgs e) - { - var element = (FrameworkElement)sender; - AnimationUtil.BeginDoubleAnimation(element, PercentProperty, null, 0, TimeSpan.FromMilliseconds(GlobalSettings.Setting.AnimationDuration.TotalMilliseconds), null, AnimationEase.CubicInOut); - - if (element.GetValue(CheckedShadowColorProperty) is Color) - { - var effect = GetEffect(element); - if (effect == null) - { - return; - } - var shadowColor = element.GetValue(ShadowColorProperty); - if (shadowColor == null) - { - AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, 0, GlobalSettings.Setting.AnimationDuration); - } - else - { - AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, (Color)shadowColor, GlobalSettings.Setting.AnimationDuration); - } - } - - } - - private static void Element_Checked(object sender, RoutedEventArgs e) - { - var element = (FrameworkElement)sender; - AnimationUtil.BeginDoubleAnimation(element, PercentProperty, null, 1, TimeSpan.FromMilliseconds(GlobalSettings.Setting.AnimationDuration.TotalMilliseconds), null, AnimationEase.CubicInOut); - - if (element.GetValue(CheckedShadowColorProperty) is Color checkedShadowColor) - { - var effect = GetEffect(element); - if (effect == null) - { - effect = new DropShadowEffect() - { - Color = checkedShadowColor, - ShadowDepth = ShadowHelper.GetShadowDepth(element), - Direction = ShadowHelper.GetDirection(element), - BlurRadius = ShadowHelper.GetBlurRadius(element), - Opacity = 0, - RenderingBias = ShadowHelper.GetRenderingBias(element), - }; - AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration); - SetEffect(element, effect); - } - else - { - AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration); - AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, checkedShadowColor, GlobalSettings.Setting.AnimationDuration); - } - } - - } - private static void OnSelectedShadowColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var element = (FrameworkElement)d; @@ -776,11 +768,19 @@ private static void Element_Hover(object sender, System.Windows.Input.MouseEvent { propertyValues.Add(GlyphBrushProperty, hoverGlyphBrush); } + if (element.GetValue(HoverToggleCornerRadiusProperty) is CornerRadius hoverToggleCornerRadius) + { + propertyValues.Add(ToggleCornerRadiusProperty, hoverToggleCornerRadius); + } if (element.GetValue(HoverToggleBrushProperty) is Brush hoverToggleBrush) { propertyValues.Add(ToggleBrushProperty, hoverToggleBrush); } - if(element.GetValue(HoverRibbonLineBrushProperty) is Brush hoverRibbonLineBrush) + if (element.GetValue(HoverToggleSizeProperty) is double hoverToggleSize) + { + propertyValues.Add(ToggleSizeProperty, hoverToggleSize); + } + if (element.GetValue(HoverRibbonLineBrushProperty) is Brush hoverRibbonLineBrush) { propertyValues.Add(RibbonLineBrushProperty, hoverRibbonLineBrush); } @@ -812,6 +812,30 @@ private static void Element_Hover(object sender, System.Windows.Input.MouseEvent AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, hoverShadowColor, GlobalSettings.Setting.AnimationDuration); } } + if (!GetHoverShadowColorLock((DependencyObject)sender) + && element.GetValue(HoverToggleShadowColorProperty) is Color hoverToggleShadowColor) + { + var effect = GetEffect(element); + if (effect == null) + { + effect = new DropShadowEffect() + { + Color = hoverToggleShadowColor, + ShadowDepth = ShadowHelper.GetShadowDepth(element), + Direction = ShadowHelper.GetDirection(element), + BlurRadius = ShadowHelper.GetBlurRadius(element), + Opacity = 0, + RenderingBias = ShadowHelper.GetRenderingBias(element), + }; + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration); + SetToggleEffect(element, effect); + } + else + { + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration); + AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, hoverToggleShadowColor, GlobalSettings.Setting.AnimationDuration); + } + } } private static void Element_Unhover(object sender, System.Windows.Input.MouseEventArgs e) @@ -855,10 +879,18 @@ private static void Element_Unhover(object sender, System.Windows.Input.MouseEve { properties.Add(GlyphBrushProperty); } + if (element.GetValue(HoverToggleSizeProperty) != null) + { + properties.Add(ToggleSizeProperty); + } if (element.GetValue(HoverToggleBrushProperty) != null) { properties.Add(ToggleBrushProperty); } + if (element.GetValue(HoverToggleCornerRadiusProperty) != null) + { + properties.Add(ToggleCornerRadiusProperty); + } if (element.GetValue(HoverRibbonLineBrushProperty) != null) { properties.Add(RibbonLineBrushProperty); @@ -885,6 +917,24 @@ private static void Element_Unhover(object sender, System.Windows.Input.MouseEve AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, (Color)shadowColor, GlobalSettings.Setting.AnimationDuration); } } + if (!GetHoverShadowColorLock((DependencyObject)sender) + && element.GetValue(HoverToggleShadowColorProperty) is Color) + { + var effect = GetToggleEffect(element); + if (effect == null) + { + return; + } + var shadowColor = element.GetValue(ToggleShadowColorProperty); + if (shadowColor == null) + { + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, 0, GlobalSettings.Setting.AnimationDuration); + } + else + { + AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, (Color)shadowColor, GlobalSettings.Setting.AnimationDuration); + } + } } private static void Element_GotFocus(object sender, RoutedEventArgs e) @@ -947,6 +997,16 @@ private static void Element_GotFocus(object sender, RoutedEventArgs e) AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, focusedShadowColor, GlobalSettings.Setting.AnimationDuration); } } + else + { + var effect = GetEffect(element); + if (effect == null) + { + return; + } + + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, 0, GlobalSettings.Setting.AnimationDuration); + } } private static void Element_LostFocus(object sender, RoutedEventArgs e) @@ -970,6 +1030,14 @@ private static void Element_LostFocus(object sender, RoutedEventArgs e) { properties.Add(BorderBrushProperty); } + if (element.GetValue(FocusedBorderThicknessProperty) != null) + { + properties.Add(BorderThicknessProperty); + } + if (element.GetValue(FocusedCornerRadiusProperty) != null) + { + properties.Add(CornerRadiusProperty); + } if (element.GetValue(FocusedWatermarkForegroundProperty) != null) { properties.Add(WatermarkForegroundProperty); @@ -1024,6 +1092,16 @@ private static void Element_Selected(object sender, RoutedEventArgs e) AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, selectedShadowColor, GlobalSettings.Setting.AnimationDuration); } } + else + { + var effect = GetEffect(element); + if (effect == null) + { + return; + } + + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, 0, GlobalSettings.Setting.AnimationDuration); + } } private static void Element_Unselected(object sender, RoutedEventArgs e) @@ -1048,6 +1126,87 @@ private static void Element_Unselected(object sender, RoutedEventArgs e) } } } + + private static void Element_Checked(object sender, RoutedEventArgs e) + { + var element = (FrameworkElement)sender; + AnimationUtil.BeginDoubleAnimation(element, PercentProperty, null, 1, TimeSpan.FromMilliseconds(GlobalSettings.Setting.AnimationDuration.TotalMilliseconds), null, AnimationEase.CubicInOut); + + if (element.GetValue(CheckedShadowColorProperty) is Color checkedShadowColor) + { + var effect = GetEffect(element); + if (effect == null) + { + effect = new DropShadowEffect() + { + Color = checkedShadowColor, + ShadowDepth = ShadowHelper.GetShadowDepth(element), + Direction = ShadowHelper.GetDirection(element), + BlurRadius = ShadowHelper.GetBlurRadius(element), + Opacity = 0, + RenderingBias = ShadowHelper.GetRenderingBias(element), + }; + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration); + SetEffect(element, effect); + } + else + { + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, ShadowHelper.GetOpacity(element), GlobalSettings.Setting.AnimationDuration); + AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, checkedShadowColor, GlobalSettings.Setting.AnimationDuration); + } + } + else + { + var effect = GetEffect(element); + if (effect == null) + { + return; + } + + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, 0, GlobalSettings.Setting.AnimationDuration); + } + + var propertyBrushes = new Dictionary(); + if (element.GetValue(CheckedCornerRadiusProperty) is CornerRadius checkedCornerRadius) + { + propertyBrushes.Add(CornerRadiusProperty, checkedCornerRadius); + } + if (propertyBrushes.Any()) + { + AnimationUtil.BeginAnimationStoryboard(element, propertyBrushes); + } + } + + private static void Element_Unchecked(object sender, RoutedEventArgs e) + { + var element = (FrameworkElement)sender; + AnimationUtil.BeginDoubleAnimation(element, PercentProperty, null, 0, TimeSpan.FromMilliseconds(GlobalSettings.Setting.AnimationDuration.TotalMilliseconds), null, AnimationEase.CubicInOut); + + if (element.GetValue(CheckedShadowColorProperty) is Color) + { + var effect = GetEffect(element); + if (effect == null) + { + return; + } + var shadowColor = element.GetValue(ShadowColorProperty); + if (shadowColor == null) + { + AnimationUtil.BeginDoubleAnimation(effect, DropShadowEffect.OpacityProperty, null, 0, GlobalSettings.Setting.AnimationDuration); + } + else + { + AnimationUtil.BeginColorAnimation(effect, DropShadowEffect.ColorProperty, null, (Color)shadowColor, GlobalSettings.Setting.AnimationDuration); + } + } + + var properties = new List(); + if (element.GetValue(CheckedCornerRadiusProperty) != null) + { + properties.Add(CornerRadiusProperty); + } + } + #endregion #region Functions diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Resources/StyleKeys.cs b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Resources/StyleKeys.cs index 142050d5..48591892 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Resources/StyleKeys.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Resources/StyleKeys.cs @@ -5,6 +5,8 @@ static class StyleKeys public const string DataGridComboBoxStyle = nameof(DataGridComboBoxStyle); public const string IconButtonStyle = nameof(IconButtonStyle); public const string IconRepeatButtonStyle = nameof(IconRepeatButtonStyle); + public const string InternalMenuItemStyle = nameof(InternalMenuItemStyle); + public const string InternalContextMenuItemStyle = nameof(InternalContextMenuItemStyle); public const string SpinStyle = nameof(SpinStyle); public const string WindowXButtonStyle = nameof(WindowXButtonStyle); public const string WindowXStyle = nameof(WindowXStyle); diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/CheckBoxStyle.xaml b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/CheckBoxStyle.xaml index b871eb92..4a60b0c2 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/CheckBoxStyle.xaml +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/CheckBoxStyle.xaml @@ -41,6 +41,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/ComboBoxItemStyle.xaml b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/ComboBoxItemStyle.xaml index 0d68a987..23bf0c08 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/ComboBoxItemStyle.xaml +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/ComboBoxItemStyle.xaml @@ -55,16 +55,22 @@ Value="{Binding Path=(local:ComboBoxHelper.ItemsHoverBackground), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" /> + + - + + - + + + + diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/MenuStyle.xaml b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/MenuStyle.xaml index e5d0fb04..df1811a3 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/MenuStyle.xaml +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/MenuStyle.xaml @@ -56,6 +56,8 @@ Value="#F1F1F1" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/SwitchStyle.xaml b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/SwitchStyle.xaml index 6b11c101..026f91fd 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/SwitchStyle.xaml +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Styles/SwitchStyle.xaml @@ -11,6 +11,12 @@ diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/CheckBoxTemplate.xaml b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/CheckBoxTemplate.xaml index 51dde7c4..d949d3b3 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/CheckBoxTemplate.xaml +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/CheckBoxTemplate.xaml @@ -23,8 +23,9 @@ Width="{Binding Path=(local:CheckBoxHelper.BoxWidth),RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Background="{Binding Path=(i:VisualStateHelper.Background), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" BorderBrush="{Binding Path=(i:VisualStateHelper.BorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="{Binding Path=(local:CheckBoxHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> + BorderThickness="{Binding Path=(i:VisualStateHelper.BorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + CornerRadius="{Binding Path=(i:VisualStateHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> - + + + + + + + + - - - - - - - + + + + + + + + + + + + + + @@ -114,11 +124,10 @@ Grid.Column="1" Source="{Binding RelativeSource={RelativeSource TemplatedParent}}" Background="{Binding Path=(i:VisualStateHelper.Background), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - BorderBrush="{Binding Path=(i:VisualStateHelper.BorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Foreground="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="{Binding Path=(local:ComboBoxItemHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + BorderBrush="{Binding Path=(i:VisualStateHelper.BorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + BorderThickness="{Binding Path=(i:VisualStateHelper.BorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + CornerRadius="{Binding Path=(i:VisualStateHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Icon="{Binding Path=(local:ComboBoxItemHelper.Icon), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" IconWidth="{Binding Path=(local:ComboBoxHelper.ItemsIconWidth), RelativeSource={RelativeSource AncestorType=ComboBox}, Mode=OneWay}" Padding="{TemplateBinding Padding}"> @@ -158,17 +167,6 @@ Property="Visibility" Value="Collapsed" /> - - - - - - - + + + + + + + + + + + + + + + @@ -256,6 +256,17 @@ Property="BorderThickness" Value="{Binding Path=(local:MenuItemHelper.CheckedBorderThickness), RelativeSource={RelativeSource Self}, Mode=OneWay}" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -349,9 +404,9 @@ Grid.Column="1" Background="{Binding Path=(i:VisualStateHelper.Background), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" BorderBrush="{Binding Path=(i:VisualStateHelper.BorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - BorderThickness="{TemplateBinding BorderThickness}" + BorderThickness="{Binding Path=(i:VisualStateHelper.BorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Foreground="{Binding Path=(i:VisualStateHelper.Foreground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" - CornerRadius="{Binding Path=(local:MenuItemHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + CornerRadius="{Binding Path=(i:VisualStateHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/RadioButtonTemplate.xaml b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/RadioButtonTemplate.xaml index 796ad215..2a2754a1 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/RadioButtonTemplate.xaml +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Templates/RadioButtonTemplate.xaml @@ -13,45 +13,47 @@ TargetType="RadioButton"> + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + Effect="{Binding Path=(i:VisualStateHelper.Effect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> @@ -22,11 +23,13 @@ - - + @@ -36,12 +39,11 @@ - + CornerRadius="{Binding Path=(i:VisualStateHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + BorderBrush="{Binding Path=(i:VisualStateHelper.BorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + BorderThickness="{Binding Path=(i:VisualStateHelper.BorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - - - - - - - - - + Width="{Binding Path=(i:VisualStateHelper.ToggleSize), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + Height="{Binding Path=(i:VisualStateHelper.ToggleSize), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + CornerRadius="{Binding Path=(i:VisualStateHelper.ToggleCornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + Background="{Binding Path=(i:VisualStateHelper.ToggleBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" + Effect="{Binding Path=(i:VisualStateHelper.ToggleEffect), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> @@ -163,6 +144,23 @@ Property="TextBlock.Foreground" Value="{Binding CheckedForeground, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + Value="{Binding Path=(local:ToggleButtonHelper.ClickBackground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Value="{Binding Path=(local:ToggleButtonHelper.ClickBorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Value="{Binding Path=(local:ToggleButtonHelper.ClickBorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Value="{Binding Path=(local:ToggleButtonHelper.ClickForeground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> + Value="{Binding Path=(local:ToggleButtonHelper.ClickForeground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Property="CornerRadius" + Value="{Binding Path=(local:ToggleButtonHelper.ClickCornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - - - - - - - + Value="{Binding Path=(local:ToggleButtonHelper.CheckedBackground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Value="{Binding Path=(local:ToggleButtonHelper.CheckedBorderBrush), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Value="{Binding Path=(local:ToggleButtonHelper.CheckedBorderThickness), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + Value="{Binding Path=(local:ToggleButtonHelper.CheckedForeground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> + Value="{Binding Path=(local:ToggleButtonHelper.CheckedForeground), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> - - + + + + + + + + Value="{Binding Path=(local:ToggleButtonHelper.CheckedCornerRadius), RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" /> diff --git a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Utils/AnimationUtil.cs b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Utils/AnimationUtil.cs index 5b7daeca..180fd30a 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Utils/AnimationUtil.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI.Internal/Utils/AnimationUtil.cs @@ -94,7 +94,15 @@ public static void BeginBrushAnimationStoryboard(DependencyObject obj, { AnimationTimeline anima = null; - if (propertyValue.Value is Brush brushValue) + if (propertyValue.Value is double doubleValue) + { + anima = new DoubleAnimation() + { + To = doubleValue, + Duration = duration ?? GlobalSettings.Setting.AnimationDuration, + }; + } + else if (propertyValue.Value is Brush brushValue) { if (!brushValue.CanFreeze) { @@ -106,7 +114,7 @@ public static void BeginBrushAnimationStoryboard(DependencyObject obj, Duration = duration ?? GlobalSettings.Setting.AnimationDuration, }; } - if (propertyValue.Value is Thickness thicknessValue) + else if (propertyValue.Value is Thickness thicknessValue) { anima = new ThicknessAnimation() { @@ -114,7 +122,7 @@ public static void BeginBrushAnimationStoryboard(DependencyObject obj, Duration = duration ?? GlobalSettings.Setting.AnimationDuration, }; } - if (propertyValue.Value is CornerRadius cornerRadiusValue) + else if (propertyValue.Value is CornerRadius cornerRadiusValue) { anima = new CornerRadiusAnimation() { @@ -138,7 +146,14 @@ public static void BeginBrushAnimationStoryboard(DependencyObject obj, { AnimationTimeline anima = null; - if (dp.PropertyType == typeof(Brush)) + if (dp.PropertyType == typeof(double)) + { + anima = new DoubleAnimation() + { + Duration = duration ?? GlobalSettings.Setting.AnimationDuration, + }; + } + else if (dp.PropertyType == typeof(Brush)) { anima = new BrushAnimation() { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Carousel.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Carousel.cs index 9302478f..bc43761e 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Carousel.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Carousel.cs @@ -273,7 +273,6 @@ private static void OnAutoPlayDurationChanged(DependencyObject d, DependencyProp carousel.UpdateAutoPlayTimer(); } - private static void OnCurrentIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs baseValue) { var carousel = (Carousel)d; diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Switch.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Switch.cs index 36c71237..03e3ca31 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Switch.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Controls/Switch.cs @@ -1,4 +1,5 @@ -using Panuon.WPF.UI.Internal.Utils; +using Panuon.WPF.UI.Internal; +using Panuon.WPF.UI.Internal.Utils; using System; using System.Windows; using System.Windows.Controls.Primitives; @@ -17,49 +18,12 @@ static Switch() KeyboardNavigation.AcceptsReturnProperty.OverrideMetadata(typeof(Switch), new FrameworkPropertyMetadata(false)); DefaultStyleKeyProperty.OverrideMetadata(typeof(Switch), new FrameworkPropertyMetadata(typeof(Switch))); } - - public Switch() - { - SwitchChecked += Switch_SwitchChecked; - SetBinding(InternalToggleShadowColorProperty, new Binding() - { - Path = new PropertyPath(ToggleShadowColorProperty), - Source = this, - }); - } #endregion #region Internal Events internal static event EventHandler SwitchChecked; #endregion - #region Overrides - - #region OnChecked - protected override void OnChecked(RoutedEventArgs e) - { - base.OnChecked(e); - RaiseSwitchChecked(); - if (CheckedToggleShadowColor is Color checkedShadowColor) - { - AnimationUtil.BeginColorAnimation(this, InternalToggleShadowColorProperty, null, checkedShadowColor, TimeSpan.FromSeconds(0.2)); - } - } - #endregion - - #region OnUnchecked - protected override void OnUnchecked(RoutedEventArgs e) - { - base.OnUnchecked(e); - if (CheckedToggleShadowColor is Color && ToggleShadowColor is Color shadowColor) - { - AnimationUtil.BeginColorAnimation(this, InternalToggleShadowColorProperty, null, shadowColor, TimeSpan.FromSeconds(0.2)); - } - } - #endregion - - #endregion - #region Properties #region GroupName @@ -92,7 +56,7 @@ public CornerRadius CornerRadius } public static readonly DependencyProperty CornerRadiusProperty = - DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(Switch)); + VisualStateHelper.CornerRadiusProperty.AddOwner(typeof(Switch)); #endregion #region BoxWidth @@ -125,7 +89,7 @@ public Brush ToggleBrush } public static readonly DependencyProperty ToggleBrushProperty = - DependencyProperty.Register("ToggleBrush", typeof(Brush), typeof(Switch)); + VisualStateHelper.ToggleBrushProperty.AddOwner(typeof(Switch)); #endregion #region ToggleSize @@ -136,7 +100,7 @@ public double ToggleSize } public static readonly DependencyProperty ToggleSizeProperty = - DependencyProperty.Register("ToggleSize", typeof(double), typeof(Switch)); + VisualStateHelper.ToggleSizeProperty.AddOwner(typeof(Switch)); #endregion #region ToggleShadowColor @@ -147,7 +111,7 @@ public Color? ToggleShadowColor } public static readonly DependencyProperty ToggleShadowColorProperty = - DependencyProperty.Register("ToggleShadowColor", typeof(Color?), typeof(Switch)); + VisualStateHelper.ToggleShadowColorProperty.AddOwner(typeof(Switch)); #endregion #region ToggleCornerRadius @@ -158,9 +122,129 @@ public CornerRadius ToggleCornerRadius } public static readonly DependencyProperty ToggleCornerRadiusProperty = - DependencyProperty.Register("ToggleCornerRadius", typeof(CornerRadius), typeof(Switch)); + VisualStateHelper.ToggleCornerRadiusProperty.AddOwner(typeof(Switch)); + #endregion + + #region ShadowColor + public Color? ShadowColor + { + get { return (Color?)GetValue(ShadowColorProperty); } + set { SetValue(ShadowColorProperty, value); } + } + + public static readonly DependencyProperty ShadowColorProperty = + VisualStateHelper.ShadowColorProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverBackground + public Brush HoverBackground + { + get { return (Brush)GetValue(HoverBackgroundProperty); } + set { SetValue(HoverBackgroundProperty, value); } + } + + public static readonly DependencyProperty HoverBackgroundProperty = + VisualStateHelper.HoverBackgroundProperty.AddOwner(typeof(Switch)); #endregion + #region HoverForeground + public Brush HoverForeground + { + get { return (Brush)GetValue(HoverForegroundProperty); } + set { SetValue(HoverForegroundProperty, value); } + } + + public static readonly DependencyProperty HoverForegroundProperty = + VisualStateHelper.HoverForegroundProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverBorderBrush + public Brush HoverBorderBrush + { + get { return (Brush)GetValue(HoverBorderBrushProperty); } + set { SetValue(HoverBorderBrushProperty, value); } + } + + public static readonly DependencyProperty HoverBorderBrushProperty = + VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverBorderThickness + public Thickness? HoverBorderThickness + { + get { return (Thickness?)GetValue(HoverBorderThicknessProperty); } + set { SetValue(HoverBorderThicknessProperty, value); } + } + + public static readonly DependencyProperty HoverBorderThicknessProperty = + VisualStateHelper.HoverBorderThicknessProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverShadowColor + public Color? HoverShadowColor + { + get { return (Color?)GetValue(HoverShadowColorProperty); } + set { SetValue(HoverShadowColorProperty, value); } + } + + public static readonly DependencyProperty HoverShadowColorProperty = + VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverToggleSize + public double? HoverToggleSize + { + get { return (double?)GetValue(HoverToggleSizeProperty); } + set { SetValue(HoverToggleSizeProperty, value); } + } + + public static readonly DependencyProperty HoverToggleSizeProperty = + VisualStateHelper.HoverToggleSizeProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverToggleBrush + public Brush HoverToggleBrush + { + get { return (Brush)GetValue(HoverToggleBrushProperty); } + set { SetValue(HoverToggleBrushProperty, value); } + } + + public static readonly DependencyProperty HoverToggleBrushProperty = + VisualStateHelper.HoverToggleBrushProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverToggleCornerRadius + public CornerRadius? HoverToggleCornerRadius + { + get { return (CornerRadius?)GetValue(HoverToggleCornerRadiusProperty); } + set { SetValue(HoverToggleCornerRadiusProperty, value); } + } + + public static readonly DependencyProperty HoverToggleCornerRadiusProperty = + VisualStateHelper.HoverToggleCornerRadiusProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverCornerRadius + public CornerRadius? HoverCornerRadius + { + get { return (CornerRadius?)GetValue(HoverCornerRadiusProperty); } + set { SetValue(HoverCornerRadiusProperty, value); } + } + + public static readonly DependencyProperty HoverCornerRadiusProperty = + VisualStateHelper.HoverCornerRadiusProperty.AddOwner(typeof(Switch)); + #endregion + + #region HoverToggleShadowColor + public Color? HoverToggleShadowColor + { + get { return (Color?)GetValue(HoverToggleShadowColorProperty); } + set { SetValue(HoverToggleShadowColorProperty, value); } + } + + public static readonly DependencyProperty HoverToggleShadowColorProperty = + VisualStateHelper.HoverToggleShadowColorProperty.AddOwner(typeof(Switch)); + #endregion #region CheckedBackground public Brush CheckedBackground @@ -206,6 +290,17 @@ public Thickness? CheckedBorderThickness DependencyProperty.Register("CheckedBorderThickness", typeof(Thickness?), typeof(Switch)); #endregion + #region CheckedToggleSize + public double? CheckedToggleSize + { + get { return (double?)GetValue(CheckedToggleSizeProperty); } + set { SetValue(CheckedToggleSizeProperty, value); } + } + + public static readonly DependencyProperty CheckedToggleSizeProperty = + DependencyProperty.Register("CheckedToggleSize", typeof(double?), typeof(Switch)); + #endregion + #region CheckedToggleBrush public Brush CheckedToggleBrush { @@ -217,6 +312,28 @@ public Brush CheckedToggleBrush DependencyProperty.Register("CheckedToggleBrush", typeof(Brush), typeof(Switch)); #endregion + #region CheckedToggleCornerRadius + public CornerRadius? CheckedToggleCornerRadius + { + get { return (CornerRadius?)GetValue(CheckedToggleCornerRadiusProperty); } + set { SetValue(CheckedToggleCornerRadiusProperty, value); } + } + + public static readonly DependencyProperty CheckedToggleCornerRadiusProperty = + DependencyProperty.Register("CheckedToggleCornerRadius", typeof(CornerRadius?), typeof(Switch)); + #endregion + + #region CheckedShadowColor + public Color? CheckedShadowColor + { + get { return (Color?)GetValue(CheckedShadowColorProperty); } + set { SetValue(CheckedShadowColorProperty, value); } + } + + public static readonly DependencyProperty CheckedShadowColorProperty = + VisualStateHelper.CheckedShadowColorProperty.AddOwner(typeof(Switch)); + #endregion + #region CheckedContent public object CheckedContent { @@ -239,19 +356,15 @@ public Color? CheckedToggleShadowColor DependencyProperty.Register("CheckedToggleShadowColor", typeof(Color?), typeof(Switch)); #endregion - #endregion - - #region Internal Properties - - #region InternalToggleShadowColor - internal Color? InternalToggleShadowColor + #region CheckedCornerRadius + public CornerRadius? CheckedCornerRadius { - get { return (Color?)GetValue(InternalToggleShadowColorProperty); } - set { SetValue(InternalToggleShadowColorProperty, value); } + get { return (CornerRadius?)GetValue(CheckedCornerRadiusProperty); } + set { SetValue(CheckedCornerRadiusProperty, value); } } - internal static readonly DependencyProperty InternalToggleShadowColorProperty = - DependencyProperty.Register("InternalToggleShadowColor", typeof(Color?), typeof(Switch)); + public static readonly DependencyProperty CheckedCornerRadiusProperty = + DependencyProperty.Register("CheckedCornerRadius", typeof(CornerRadius?), typeof(Switch)); #endregion #endregion diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Controls/ThumbFence.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Controls/ThumbFence.cs index 6e7f990f..64baf6f3 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Controls/ThumbFence.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Controls/ThumbFence.cs @@ -226,7 +226,7 @@ private void Relocation() } var thumbWidth = _thumb.RenderSize.Width; - var thumbHeight = _thumb.RenderSize.Width; + var thumbHeight = _thumb.RenderSize.Height; var halfThumbWidth = thumbWidth / 2; var halfThumbHeight = thumbHeight / 2; var renderWidth = _canvas.RenderSize.Width; diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/CheckBoxHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/CheckBoxHelper.cs index e07ab8bb..6c0ba425 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/CheckBoxHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/CheckBoxHelper.cs @@ -19,7 +19,7 @@ public static void SetCornerRadius(CheckBox checkBox, CornerRadius value) } public static readonly DependencyProperty CornerRadiusProperty = - DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(CheckBoxHelper)); + VisualStateHelper.CornerRadiusProperty.AddOwner(typeof(CheckBoxHelper)); #endregion #region BoxHeight @@ -66,7 +66,22 @@ public static void SetContentPlacement(CheckBox checkBox, ContentPlacement value public static readonly DependencyProperty ContentPlacementProperty = DependencyProperty.RegisterAttached("ContentPlacement", typeof(ContentPlacement), typeof(CheckBoxHelper), new PropertyMetadata(ContentPlacement.Right)); #endregion - + + #region ShadowColor + public static Color? GetShadowColor(CheckBox checkBox) + { + return (Color?)checkBox.GetValue(ShadowColorProperty); + } + + public static void SetShadowColor(CheckBox checkBox, Color? value) + { + checkBox.SetValue(ShadowColorProperty, value); + } + + public static readonly DependencyProperty ShadowColorProperty = + VisualStateHelper.ShadowColorProperty.AddOwner(typeof(CheckBoxHelper)); + #endregion + #region GlyphBrush public static Brush GetGlyphBrush(CheckBox checkBox) { @@ -142,6 +157,36 @@ public static void SetHoverBorderBrush(CheckBox checkBox, Brush value) VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(CheckBoxHelper)); #endregion + #region HoverBorderThickness + public static Thickness? GetHoverBorderThickness(CheckBox checkBox) + { + return (Thickness?)checkBox.GetValue(HoverBorderThicknessProperty); + } + + public static void SetHoverBorderThickness(CheckBox checkBox, Thickness? value) + { + checkBox.SetValue(HoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty HoverBorderThicknessProperty = + VisualStateHelper.HoverBorderThicknessProperty.AddOwner(typeof(CheckBoxHelper)); + #endregion + + #region HoverCornerRadius + public static CornerRadius? GetHoverCornerRadius(CheckBox checkBox) + { + return (CornerRadius?)checkBox.GetValue(HoverCornerRadiusProperty); + } + + public static void SetHoverCornerRadius(CheckBox checkBox, CornerRadius? value) + { + checkBox.SetValue(HoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty HoverCornerRadiusProperty = + VisualStateHelper.HoverCornerRadiusProperty.AddOwner(typeof(CheckBoxHelper)); + #endregion + #region HoverGlyphBrush public static Brush GetHoverGlyphBrush(CheckBox checkBox) { @@ -157,6 +202,20 @@ public static void SetHoverGlyphBrush(CheckBox checkBox, Brush value) VisualStateHelper.HoverGlyphBrushProperty.AddOwner(typeof(CheckBoxHelper)); #endregion + #region HoverShadowColor + public static Color? GetHoverShadowColor(CheckBox checkBox) + { + return (Color?)checkBox.GetValue(HoverShadowColorProperty); + } + + public static void SetHoverShadowColor(CheckBox checkBox, Color? value) + { + checkBox.SetValue(HoverShadowColorProperty, value); + } + public static readonly DependencyProperty HoverShadowColorProperty = + VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(CheckBoxHelper)); + #endregion + #region CheckedForeground public static Brush GetCheckedForeground(CheckBox checkBox) { @@ -232,6 +291,35 @@ public static void SetCheckedGlyphBrush(CheckBox checkBox, Brush value) DependencyProperty.RegisterAttached("CheckedGlyphBrush", typeof(Brush), typeof(CheckBoxHelper)); #endregion + #region CheckedCornerRadius + public static CornerRadius? GetCheckedCornerRadius(CheckBox checkBox) + { + return (CornerRadius?)checkBox.GetValue(CheckedCornerRadiusProperty); + } + + public static void SetCheckedCornerRadius(CheckBox checkBox, CornerRadius? value) + { + checkBox.SetValue(CheckedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty CheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("CheckedCornerRadius", typeof(CornerRadius?), typeof(CheckBoxHelper)); + #endregion + + #region CheckedShadowColor + public static Color? GetCheckedShadowColor(CheckBox checkBox) + { + return (Color?)checkBox.GetValue(CheckedShadowColorProperty); + } + + public static void SetCheckedShadowColor(CheckBox checkBox, Color? value) + { + checkBox.SetValue(CheckedShadowColorProperty, value); + } + public static readonly DependencyProperty CheckedShadowColorProperty = + VisualStateHelper.CheckedShadowColorProperty.AddOwner(typeof(CheckBoxHelper)); + #endregion + #region CheckedContent public static object GetCheckedContent(CheckBox checkBox) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxHelper.cs index 22efe413..f720fe04 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxHelper.cs @@ -786,6 +786,36 @@ public static void SetItemsHoverBorderBrush(ComboBox comboBox, Brush value) DependencyProperty.RegisterAttached("ItemsHoverBorderBrush", typeof(Brush), typeof(ComboBoxHelper)); #endregion + #region ItemsHoverBorderThickness + public static Thickness? GetItemsHoverBorderThickness(ComboBox comboBox) + { + return (Thickness?)comboBox.GetValue(ItemsHoverBorderThicknessProperty); + } + + public static void SetItemsHoverBorderThickness(ComboBox comboBox, Thickness? value) + { + comboBox.SetValue(ItemsHoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty ItemsHoverBorderThicknessProperty = + DependencyProperty.RegisterAttached("ItemsHoverBorderThickness", typeof(Thickness?), typeof(ComboBoxHelper)); + #endregion + + #region ItemsHoverCornerRadius + public static CornerRadius? GetItemsHoverCornerRadius(ComboBox comboBox) + { + return (CornerRadius?)comboBox.GetValue(ItemsHoverCornerRadiusProperty); + } + + public static void SetItemsHoverCornerRadius(ComboBox comboBox, CornerRadius? value) + { + comboBox.SetValue(ItemsHoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ItemsHoverCornerRadiusProperty = + DependencyProperty.RegisterAttached("ItemsHoverCornerRadius", typeof(CornerRadius?), typeof(ComboBoxHelper)); + #endregion + #region ItemsSelectedBackground public static Brush GetItemsSelectedBackground(ComboBox comboBox) { @@ -846,6 +876,21 @@ public static void SetItemsSelectedBorderThickness(ComboBox comboBox, Thickness? DependencyProperty.RegisterAttached("ItemsSelectedBorderThickness", typeof(Thickness?), typeof(ComboBoxHelper)); #endregion + #region ItemsSelectedCornerRadius + public static CornerRadius? GetItemsSelectedCornerRadius(ComboBox comboBox) + { + return (CornerRadius?)comboBox.GetValue(ItemsSelectedCornerRadiusProperty); + } + + public static void SetItemsSelectedCornerRadius(ComboBox comboBox, CornerRadius? value) + { + comboBox.SetValue(ItemsSelectedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ItemsSelectedCornerRadiusProperty = + DependencyProperty.RegisterAttached("ItemsSelectedCornerRadius", typeof(CornerRadius?), typeof(ComboBoxHelper)); + #endregion + #region ItemsRemoveButtonVisibility public static AuxiliaryButtonVisibility GetItemsRemoveButtonVisibility(ComboBox comboBox) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxItemHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxItemHelper.cs index acebc296..39ee99c5 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxItemHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ComboBoxItemHelper.cs @@ -34,7 +34,7 @@ public static void SetCornerRadius(ComboBoxItem comboBoxItem, CornerRadius value } public static readonly DependencyProperty CornerRadiusProperty = - DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ComboBoxItemHelper)); + VisualStateHelper.CornerRadiusProperty.AddOwner(typeof(ComboBoxItemHelper)); #endregion #region RemoveButtonVisibility @@ -97,6 +97,36 @@ public static void SetHoverBorderBrush(ComboBoxItem comboBoxItem, Brush value) VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(ComboBoxItemHelper)); #endregion + #region HoverBorderThickness + public static Thickness? GetHoverBorderThickness(ComboBoxItem comboBoxItem) + { + return (Thickness?)comboBoxItem.GetValue(HoverBorderThicknessProperty); + } + + public static void SetHoverBorderThickness(ComboBoxItem comboBoxItem, Thickness? value) + { + comboBoxItem.SetValue(HoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty HoverBorderThicknessProperty = + VisualStateHelper.HoverBorderThicknessProperty.AddOwner(typeof(ComboBoxItemHelper)); + #endregion + + #region HoverCornerRadius + public static CornerRadius? GetHoverCornerRadius(ComboBoxItem comboBoxItem) + { + return (CornerRadius?)comboBoxItem.GetValue(HoverCornerRadiusProperty); + } + + public static void SetHoverCornerRadius(ComboBoxItem comboBoxItem, CornerRadius? value) + { + comboBoxItem.SetValue(HoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty HoverCornerRadiusProperty = + VisualStateHelper.HoverCornerRadiusProperty.AddOwner(typeof(ComboBoxItemHelper)); + #endregion + #region SelectedBackground public static Brush GetSelectedBackground(ComboBoxItem comboBoxItem) { @@ -157,6 +187,21 @@ public static void SetSelectedBorderThickness(ComboBoxItem comboBoxItem, Thickne DependencyProperty.RegisterAttached("SelectedBorderThickness", typeof(Thickness?), typeof(ComboBoxItemHelper)); #endregion + #region SelectedCornerRadius + public static CornerRadius? GetSelectedCornerRadius(ComboBoxItem comboBoxItem) + { + return (CornerRadius?)comboBoxItem.GetValue(SelectedCornerRadiusProperty); + } + + public static void SetSelectedCornerRadius(ComboBoxItem comboBoxItem, CornerRadius? value) + { + comboBoxItem.SetValue(SelectedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty SelectedCornerRadiusProperty = + DependencyProperty.RegisterAttached("SelectedCornerRadius", typeof(CornerRadius?), typeof(ComboBoxItemHelper)); + #endregion + #region SeparatorBrush public static Brush GetSeparatorBrush(ComboBoxItem comboBoxItem) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ContextMenuHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ContextMenuHelper.cs index 283d8226..488617f9 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ContextMenuHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ContextMenuHelper.cs @@ -333,6 +333,36 @@ public static void SetItemsHoverBorderBrush(ContextMenu contextMenu, Brush value DependencyProperty.RegisterAttached("ItemsHoverBorderBrush", typeof(Brush), typeof(ContextMenuHelper)); #endregion + #region ItemsHoverBorderThickness + public static Thickness? GetItemsHoverBorderThickness(ContextMenu contextMenu) + { + return (Thickness?)contextMenu.GetValue(ItemsHoverBorderThicknessProperty); + } + + public static void SetItemsHoverBorderThickness(ContextMenu contextMenu, Thickness? value) + { + contextMenu.SetValue(ItemsHoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty ItemsHoverBorderThicknessProperty = + DependencyProperty.RegisterAttached("ItemsHoverBorderThickness", typeof(Thickness?), typeof(ContextMenuHelper)); + #endregion + + #region ItemsHoverCornerRadius + public static CornerRadius? GetItemsHoverCornerRadius(ContextMenu contextMenu) + { + return (CornerRadius?)contextMenu.GetValue(ItemsHoverCornerRadiusProperty); + } + + public static void SetItemsHoverCornerRadius(ContextMenu contextMenu, CornerRadius? value) + { + contextMenu.SetValue(ItemsHoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ItemsHoverCornerRadiusProperty = + DependencyProperty.RegisterAttached("ItemsHoverCornerRadius", typeof(CornerRadius?), typeof(ContextMenuHelper)); + #endregion + #region ItemsClickBackground public static Brush GetItemsClickBackground(ContextMenu contextMenu) { @@ -378,6 +408,36 @@ public static void SetItemsClickBorderBrush(ContextMenu contextMenu, Brush value DependencyProperty.RegisterAttached("ItemsClickBorderBrush", typeof(Brush), typeof(ContextMenuHelper)); #endregion + #region ItemsClickBorderThickness + public static Thickness? GetItemsClickBorderThickness(ContextMenu contextMenu) + { + return (Thickness?)contextMenu.GetValue(ItemsClickBorderThicknessProperty); + } + + public static void SetItemsClickBorderThickness(ContextMenu contextMenu, Thickness? value) + { + contextMenu.SetValue(ItemsClickBorderThicknessProperty, value); + } + + public static readonly DependencyProperty ItemsClickBorderThicknessProperty = + DependencyProperty.RegisterAttached("ItemsClickBorderThickness", typeof(Thickness?), typeof(ContextMenuHelper)); + #endregion + + #region ItemsClickCornerRadius + public static CornerRadius? GetItemsClickCornerRadius(ContextMenu contextMenu) + { + return (CornerRadius?)contextMenu.GetValue(ItemsClickCornerRadiusProperty); + } + + public static void SetItemsClickCornerRadius(ContextMenu contextMenu, CornerRadius? value) + { + contextMenu.SetValue(ItemsClickCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ItemsClickCornerRadiusProperty = + DependencyProperty.RegisterAttached("ItemsClickCornerRadius", typeof(CornerRadius?), typeof(ContextMenuHelper)); + #endregion + #region ItemsOpenedBackground public static Brush GetItemsOpenedBackground(ContextMenu contextMenu) { @@ -423,6 +483,36 @@ public static void SetItemsOpenedBorderBrush(ContextMenu contextMenu, Brush valu DependencyProperty.RegisterAttached("ItemsOpenedBorderBrush", typeof(Brush), typeof(ContextMenuHelper)); #endregion + #region ItemsOpenedBorderThickness + public static Thickness? GetItemsOpenedBorderThickness(ContextMenu contextMenu) + { + return (Thickness?)contextMenu.GetValue(ItemsOpenedBorderThicknessProperty); + } + + public static void SetItemsOpenedBorderThickness(ContextMenu contextMenu, Thickness? value) + { + contextMenu.SetValue(ItemsOpenedBorderThicknessProperty, value); + } + + public static readonly DependencyProperty ItemsOpenedBorderThicknessProperty = + DependencyProperty.RegisterAttached("ItemsOpenedBorderThickness", typeof(Thickness?), typeof(ContextMenuHelper)); + #endregion + + #region ItemsOpenedCornerRadius + public static CornerRadius? GetItemsOpenedCornerRadius(ContextMenu contextMenu) + { + return (CornerRadius?)contextMenu.GetValue(ItemsOpenedCornerRadiusProperty); + } + + public static void SetItemsOpenedCornerRadius(ContextMenu contextMenu, CornerRadius? value) + { + contextMenu.SetValue(ItemsOpenedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ItemsOpenedCornerRadiusProperty = + DependencyProperty.RegisterAttached("ItemsOpenedCornerRadius", typeof(CornerRadius?), typeof(ContextMenuHelper)); + #endregion + #region ItemsCheckedBackground public static Brush GetItemsCheckedBackground(ContextMenu contextMenu) { @@ -483,6 +573,21 @@ public static void SetItemsCheckedBorderThickness(ContextMenu contextMenu, Thick DependencyProperty.RegisterAttached("ItemsCheckedBorderThickness", typeof(Thickness?), typeof(ContextMenuHelper)); #endregion + #region ItemsCheckedCornerRadius + public static CornerRadius? GetItemsCheckedCornerRadius(ContextMenu contextMenu) + { + return (CornerRadius?)contextMenu.GetValue(ItemsCheckedCornerRadiusProperty); + } + + public static void SetItemsCheckedCornerRadius(ContextMenu contextMenu, CornerRadius? value) + { + contextMenu.SetValue(ItemsCheckedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ItemsCheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("ItemsCheckedCornerRadius", typeof(CornerRadius?), typeof(ContextMenuHelper)); + #endregion + #region ItemsSeparatorBrush public static Brush GetItemsSeparatorBrush(ContextMenu contextMenu) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuHelper.cs index 2245d819..0705499b 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuHelper.cs @@ -326,6 +326,36 @@ public static void SetTopLevelItemsHoverBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("TopLevelItemsHoverBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region TopLevelItemsHoverBorderThickness + public static Thickness? GetTopLevelItemsHoverBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(TopLevelItemsHoverBorderThicknessProperty); + } + + public static void SetTopLevelItemsHoverBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(TopLevelItemsHoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsHoverBorderThicknessProperty = + DependencyProperty.RegisterAttached("TopLevelItemsHoverBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region TopLevelItemsHoverCornerRadius + public static CornerRadius? GetTopLevelItemsHoverCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(TopLevelItemsHoverCornerRadiusProperty); + } + + public static void SetTopLevelItemsHoverCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(TopLevelItemsHoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsHoverCornerRadiusProperty = + DependencyProperty.RegisterAttached("TopLevelItemsHoverCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region TopLevelItemsClickBackground public static Brush GetTopLevelItemsClickBackground(Menu menu) { @@ -371,6 +401,36 @@ public static void SetTopLevelItemsClickBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("TopLevelItemsClickBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region TopLevelItemsClickBorderThickness + public static Thickness? GetTopLevelItemsClickBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(TopLevelItemsClickBorderThicknessProperty); + } + + public static void SetTopLevelItemsClickBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(TopLevelItemsClickBorderThicknessProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsClickBorderThicknessProperty = + DependencyProperty.RegisterAttached("TopLevelItemsClickBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region TopLevelItemsClickCornerRadius + public static CornerRadius? GetTopLevelItemsClickCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(TopLevelItemsClickCornerRadiusProperty); + } + + public static void SetTopLevelItemsClickCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(TopLevelItemsClickCornerRadiusProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsClickCornerRadiusProperty = + DependencyProperty.RegisterAttached("TopLevelItemsClickCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region TopLevelItemsOpenedBackground public static Brush GetTopLevelItemsOpenedBackground(Menu menu) { @@ -416,6 +476,36 @@ public static void SetTopLevelItemsOpenedBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("TopLevelItemsOpenedBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region TopLevelItemsOpenedBorderThickness + public static Thickness? GetTopLevelItemsOpenedBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(TopLevelItemsOpenedBorderThicknessProperty); + } + + public static void SetTopLevelItemsOpenedBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(TopLevelItemsOpenedBorderThicknessProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsOpenedBorderThicknessProperty = + DependencyProperty.RegisterAttached("TopLevelItemsOpenedBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region TopLevelItemsOpenedCornerRadius + public static CornerRadius? GetTopLevelItemsOpenedCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(TopLevelItemsOpenedCornerRadiusProperty); + } + + public static void SetTopLevelItemsOpenedCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(TopLevelItemsOpenedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsOpenedCornerRadiusProperty = + DependencyProperty.RegisterAttached("TopLevelItemsOpenedCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region TopLevelItemsCheckedBackground public static Brush GetTopLevelItemsCheckedBackground(Menu menu) { @@ -461,6 +551,36 @@ public static void SetTopLevelItemsCheckedBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("TopLevelItemsCheckedBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region TopLevelItemsCheckedBorderThickness + public static Thickness? GetTopLevelItemsCheckedBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(TopLevelItemsCheckedBorderThicknessProperty); + } + + public static void SetTopLevelItemsCheckedBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(TopLevelItemsCheckedBorderThicknessProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsCheckedBorderThicknessProperty = + DependencyProperty.RegisterAttached("TopLevelItemsCheckedBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region TopLevelItemsCheckedCornerRadius + public static CornerRadius? GetTopLevelItemsCheckedCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(TopLevelItemsCheckedCornerRadiusProperty); + } + + public static void SetTopLevelItemsCheckedCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(TopLevelItemsCheckedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty TopLevelItemsCheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("TopLevelItemsCheckedCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region TopLevelItemsSeparatorBrush public static Brush GetTopLevelItemsSeparatorBrush(Menu menu) { @@ -768,6 +888,36 @@ public static void SetSubmenuItemsHoverBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("SubmenuItemsHoverBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region SubmenuItemsHoverBorderThickness + public static Thickness? GetSubmenuItemsHoverBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(SubmenuItemsHoverBorderThicknessProperty); + } + + public static void SetSubmenuItemsHoverBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(SubmenuItemsHoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsHoverBorderThicknessProperty = + DependencyProperty.RegisterAttached("SubmenuItemsHoverBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region SubmenuItemsHoverCornerRadius + public static CornerRadius? GetSubmenuItemsHoverCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(SubmenuItemsHoverCornerRadiusProperty); + } + + public static void SetSubmenuItemsHoverCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(SubmenuItemsHoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsHoverCornerRadiusProperty = + DependencyProperty.RegisterAttached("SubmenuItemsHoverCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region SubmenuItemsClickBackground public static Brush GetSubmenuItemsClickBackground(Menu menu) { @@ -813,6 +963,36 @@ public static void SetSubmenuItemsClickBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("SubmenuItemsClickBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region SubmenuItemsClickBorderThickness + public static Thickness? GetSubmenuItemsClickBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(SubmenuItemsClickBorderThicknessProperty); + } + + public static void SetSubmenuItemsClickBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(SubmenuItemsClickBorderThicknessProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsClickBorderThicknessProperty = + DependencyProperty.RegisterAttached("SubmenuItemsClickBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region SubmenuItemsClickCornerRadius + public static CornerRadius? GetSubmenuItemsClickCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(SubmenuItemsClickCornerRadiusProperty); + } + + public static void SetSubmenuItemsClickCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(SubmenuItemsClickCornerRadiusProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsClickCornerRadiusProperty = + DependencyProperty.RegisterAttached("SubmenuItemsClickCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region SubmenuItemsOpenedBackground public static Brush GetSubmenuItemsOpenedBackground(Menu menu) { @@ -858,6 +1038,36 @@ public static void SetSubmenuItemsOpenedBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("SubmenuItemsOpenedBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region SubmenuItemsOpenedBorderThickness + public static Thickness? GetSubmenuItemsOpenedBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(SubmenuItemsOpenedBorderThicknessProperty); + } + + public static void SetSubmenuItemsOpenedBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(SubmenuItemsOpenedBorderThicknessProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsOpenedBorderThicknessProperty = + DependencyProperty.RegisterAttached("SubmenuItemsOpenedBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region SubmenuItemsOpenedCornerRadius + public static CornerRadius? GetSubmenuItemsOpenedCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(SubmenuItemsOpenedCornerRadiusProperty); + } + + public static void SetSubmenuItemsOpenedCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(SubmenuItemsOpenedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsOpenedCornerRadiusProperty = + DependencyProperty.RegisterAttached("SubmenuItemsOpenedCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region SubmenuItemsCheckedBackground public static Brush GetSubmenuItemsCheckedBackground(Menu menu) { @@ -903,6 +1113,36 @@ public static void SetSubmenuItemsCheckedBorderBrush(Menu menu, Brush value) DependencyProperty.RegisterAttached("SubmenuItemsCheckedBorderBrush", typeof(Brush), typeof(MenuHelper)); #endregion + #region SubmenuItemsCheckedBorderThickness + public static Thickness? GetSubmenuItemsCheckedBorderThickness(Menu menu) + { + return (Thickness?)menu.GetValue(SubmenuItemsCheckedBorderThicknessProperty); + } + + public static void SetSubmenuItemsCheckedBorderThickness(Menu menu, Thickness? value) + { + menu.SetValue(SubmenuItemsCheckedBorderThicknessProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsCheckedBorderThicknessProperty = + DependencyProperty.RegisterAttached("SubmenuItemsCheckedBorderThickness", typeof(Thickness?), typeof(MenuHelper)); + #endregion + + #region SubmenuItemsCheckedCornerRadius + public static CornerRadius? GetSubmenuItemsCheckedCornerRadius(Menu menu) + { + return (CornerRadius?)menu.GetValue(SubmenuItemsCheckedCornerRadiusProperty); + } + + public static void SetSubmenuItemsCheckedCornerRadius(Menu menu, CornerRadius? value) + { + menu.SetValue(SubmenuItemsCheckedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty SubmenuItemsCheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("SubmenuItemsCheckedCornerRadius", typeof(CornerRadius?), typeof(MenuHelper)); + #endregion + #region SubmenuItemsSeparatorBrush public static Brush GetSubmenuItemsSeparatorBrush(Menu menu) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuItemHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuItemHelper.cs index dcd66cc9..12466196 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuItemHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/MenuItemHelper.cs @@ -82,6 +82,36 @@ public static void SetHoverBorderBrush(MenuItem menuItem, Brush value) VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(MenuItemHelper)); #endregion + #region HoverBorderThickness + public static Thickness? GetHoverBorderThickness(MenuItem menuItem) + { + return (Thickness?)menuItem.GetValue(HoverBorderThicknessProperty); + } + + public static void SetHoverBorderThickness(MenuItem menuItem, Thickness? value) + { + menuItem.SetValue(HoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty HoverBorderThicknessProperty = + VisualStateHelper.HoverBorderThicknessProperty.AddOwner(typeof(MenuItemHelper)); + #endregion + + #region HoverCornerRadius + public static CornerRadius? GetHoverCornerRadius(MenuItem menuItem) + { + return (CornerRadius?)menuItem.GetValue(HoverCornerRadiusProperty); + } + + public static void SetHoverCornerRadius(MenuItem menuItem, CornerRadius? value) + { + menuItem.SetValue(HoverCornerRadiusProperty, value); + } + + public static readonly DependencyProperty HoverCornerRadiusProperty = + VisualStateHelper.HoverCornerRadiusProperty.AddOwner(typeof(MenuItemHelper)); + #endregion + #region ClickBackground public static Brush GetClickBackground(MenuItem menuItem) { @@ -127,6 +157,36 @@ public static void SetClickBorderBrush(MenuItem menuItem, Brush value) DependencyProperty.RegisterAttached("ClickBorderBrush", typeof(Brush), typeof(MenuItemHelper)); #endregion + #region ClickBorderThickness + public static Thickness? GetClickBorderThickness(MenuItem menuItem) + { + return (Thickness?)menuItem.GetValue(ClickBorderThicknessProperty); + } + + public static void SetClickBorderThickness(MenuItem menuItem, Thickness? value) + { + menuItem.SetValue(ClickBorderThicknessProperty, value); + } + + public static readonly DependencyProperty ClickBorderThicknessProperty = + DependencyProperty.RegisterAttached("ClickBorderThickness", typeof(Thickness?), typeof(MenuItemHelper)); + #endregion + + #region ClickCornerRadius + public static CornerRadius? GetClickCornerRadius(MenuItem menuItem) + { + return (CornerRadius?)menuItem.GetValue(ClickCornerRadiusProperty); + } + + public static void SetClickCornerRadius(MenuItem menuItem, CornerRadius? value) + { + menuItem.SetValue(ClickCornerRadiusProperty, value); + } + + public static readonly DependencyProperty ClickCornerRadiusProperty = + DependencyProperty.RegisterAttached("ClickCornerRadius", typeof(CornerRadius?), typeof(MenuItemHelper)); + #endregion + #region OpenedBackground public static Brush GetOpenedBackground(MenuItem menuItem) { @@ -172,6 +232,36 @@ public static void SetOpenedBorderBrush(MenuItem menuItem, Brush value) DependencyProperty.RegisterAttached("OpenedBorderBrush", typeof(Brush), typeof(MenuItemHelper)); #endregion + #region OpenedBorderThickness + public static Thickness? GetOpenedBorderThickness(MenuItem menuItem) + { + return (Thickness?)menuItem.GetValue(OpenedBorderThicknessProperty); + } + + public static void SetOpenedBorderThickness(MenuItem menuItem, Thickness? value) + { + menuItem.SetValue(OpenedBorderThicknessProperty, value); + } + + public static readonly DependencyProperty OpenedBorderThicknessProperty = + DependencyProperty.RegisterAttached("OpenedBorderThickness", typeof(Thickness?), typeof(MenuItemHelper)); + #endregion + + #region OpenedCornerRadius + public static CornerRadius? GetOpenedCornerRadius(MenuItem menuItem) + { + return (CornerRadius?)menuItem.GetValue(OpenedCornerRadiusProperty); + } + + public static void SetOpenedCornerRadius(MenuItem menuItem, CornerRadius? value) + { + menuItem.SetValue(OpenedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty OpenedCornerRadiusProperty = + DependencyProperty.RegisterAttached("OpenedCornerRadius", typeof(CornerRadius?), typeof(MenuItemHelper)); + #endregion + #region CheckedBackground public static Brush GetCheckedBackground(MenuItem menuItem) { @@ -232,6 +322,21 @@ public static void SetCheckedBorderThickness(MenuItem menuItem, Thickness? value DependencyProperty.RegisterAttached("CheckedBorderThickness", typeof(Thickness?), typeof(MenuItemHelper)); #endregion + #region CheckedCornerRadius + public static CornerRadius? GetCheckedCornerRadius(MenuItem menuItem) + { + return (CornerRadius?)menuItem.GetValue(CheckedCornerRadiusProperty); + } + + public static void SetCheckedCornerRadius(MenuItem menuItem, CornerRadius? value) + { + menuItem.SetValue(CheckedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty CheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("CheckedCornerRadius", typeof(CornerRadius?), typeof(MenuItemHelper)); + #endregion + #region SeparatorBrush public static Brush GetSeparatorBrush(MenuItem menuItem) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/RadioButtonHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/RadioButtonHelper.cs index ca29be88..1161fbc2 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/RadioButtonHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/RadioButtonHelper.cs @@ -67,6 +67,21 @@ public static void SetToggleRadius(RadioButton radioButton, double value) DependencyProperty.RegisterAttached("ToggleRadius", typeof(double), typeof(RadioButtonHelper)); #endregion + #region ShadowColor + public static Color? GetShadowColor(RadioButton radioButton) + { + return (Color?)radioButton.GetValue(ShadowColorProperty); + } + + public static void SetShadowColor(RadioButton radioButton, Color? value) + { + radioButton.SetValue(ShadowColorProperty, value); + } + + public static readonly DependencyProperty ShadowColorProperty = + VisualStateHelper.ShadowColorProperty.AddOwner(typeof(RadioButtonHelper)); + #endregion + #region HoverForeground public static Brush GetHoverForeground(RadioButton radioButton) { @@ -112,6 +127,21 @@ public static void SetHoverBorderBrush(RadioButton radioButton, Brush value) VisualStateHelper.HoverBorderBrushProperty.AddOwner(typeof(RadioButtonHelper)); #endregion + #region HoverBorderThickness + public static Thickness? GetHoverBorderThickness(RadioButton radioButton) + { + return (Thickness?)radioButton.GetValue(HoverBorderThicknessProperty); + } + + public static void SetHoverBorderThickness(RadioButton radioButton, Thickness? value) + { + radioButton.SetValue(HoverBorderThicknessProperty, value); + } + + public static readonly DependencyProperty HoverBorderThicknessProperty = + VisualStateHelper.HoverBorderThicknessProperty.AddOwner(typeof(RadioButtonHelper)); + #endregion + #region HoverToggleBrush public static Brush GetHoverToggleBrush(RadioButton radioButton) { @@ -127,6 +157,20 @@ public static void SetHoverToggleBrush(RadioButton radioButton, Brush value) VisualStateHelper.HoverToggleBrushProperty.AddOwner(typeof(RadioButtonHelper)); #endregion + #region HoverShadowColor + public static Color? GetHoverShadowColor(RadioButton radioButton) + { + return (Color?)radioButton.GetValue(HoverShadowColorProperty); + } + + public static void SetHoverShadowColor(RadioButton radioButton, Color? value) + { + radioButton.SetValue(HoverShadowColorProperty, value); + } + public static readonly DependencyProperty HoverShadowColorProperty = + VisualStateHelper.HoverShadowColorProperty.AddOwner(typeof(RadioButtonHelper)); + #endregion + #region CheckedForeground public static Brush GetCheckedForeground(RadioButton radioButton) { @@ -202,6 +246,20 @@ public static void SetCheckedToggleBrush(RadioButton radioButton, Brush value) DependencyProperty.RegisterAttached("CheckedToggleBrush", typeof(Brush), typeof(RadioButtonHelper)); #endregion + #region CheckedShadowColor + public static Color? GetCheckedShadowColor(RadioButton radioButton) + { + return (Color?)radioButton.GetValue(CheckedShadowColorProperty); + } + + public static void SetCheckedShadowColor(RadioButton radioButton, Color? value) + { + radioButton.SetValue(CheckedShadowColorProperty, value); + } + public static readonly DependencyProperty CheckedShadowColorProperty = + VisualStateHelper.CheckedShadowColorProperty.AddOwner(typeof(RadioButtonHelper)); + #endregion + #region CheckedContent public static object GetCheckedContent(RadioButton radioButton) { diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ScrollViewerHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ScrollViewerHelper.cs index b700c532..9244d1cb 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ScrollViewerHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ScrollViewerHelper.cs @@ -295,8 +295,6 @@ private static void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEven if (e.Source is UIElement source && e.OriginalSource is UIElement originalSource) { - - if (GetHandleMouseWheel(scrollViewer)) { e.Handled = true; @@ -344,9 +342,10 @@ private static void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEven } var mouseWheelDelta = GetMouseWheelDelta(scrollViewer); - mouseWheelDelta = scrollViewer.CanContentScroll - ? scrollViewer.ViewportHeight - : mouseWheelDelta; + mouseWheelDelta = (!scrollViewer.CanContentScroll || scrollViewer.ViewportHeight == scrollViewer.ActualHeight) + ? mouseWheelDelta + : scrollViewer.ViewportHeight; + switch (GetWheelScrollingDirection(scrollViewer)) { case WheelScrollingDirection.Vertical: diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ToggleButtonHelper.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ToggleButtonHelper.cs index 64b2184f..b1040d5a 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ToggleButtonHelper.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Helpers/ToggleButtonHelper.cs @@ -373,6 +373,22 @@ public static void SetClickCornerRadius(ToggleButton toggleButton, CornerRadius? DependencyProperty.RegisterAttached("ClickCornerRadius", typeof(CornerRadius?), typeof(ToggleButtonHelper)); #endregion + #region CheckedCornerRadius + public static CornerRadius? GetCheckedCornerRadius(ToggleButton toggleButton) + { + return (CornerRadius?)toggleButton.GetValue(CheckedCornerRadiusProperty); + } + + public static void SetCheckedCornerRadius(ToggleButton toggleButton, CornerRadius? value) + { + toggleButton.SetValue(CheckedCornerRadiusProperty, value); + } + + public static readonly DependencyProperty CheckedCornerRadiusProperty = + DependencyProperty.RegisterAttached("CheckedCornerRadius", typeof(CornerRadius?), typeof(ToggleButtonHelper)); + #endregion + + #endregion } -} +} \ No newline at end of file diff --git a/SourceCode/SharedResources/Panuon.WPF.UI/Properties/AssemblyInfo.cs b/SourceCode/SharedResources/Panuon.WPF.UI/Properties/AssemblyInfo.cs index b17de809..4a45bb28 100644 --- a/SourceCode/SharedResources/Panuon.WPF.UI/Properties/AssemblyInfo.cs +++ b/SourceCode/SharedResources/Panuon.WPF.UI/Properties/AssemblyInfo.cs @@ -20,5 +20,5 @@ ResourceDictionaryLocation.SourceAssembly )] -[assembly: AssemblyVersion("1.1.8.4")] -[assembly: AssemblyFileVersion("1.1.8.4")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.8.5")] +[assembly: AssemblyFileVersion("1.1.8.5")] \ No newline at end of file