using AntDesign.WPF.Controls; namespace AntDesign.WPF.Helpers { using System.ComponentModel; using System.Windows; using System.Windows.Media; using WPF.Controls; /// /// A helper class that provides various controls. /// public static class AntdControl { #region Border public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached( "CornerRadius", typeof(CornerRadius), typeof(AntdControl), new FrameworkPropertyMetadata( default(CornerRadius), FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender )); /// /// Gets a value that represents the degree to which the corners of a control border are rounded. /// [Category("AntDesign")] public static CornerRadius GetCornerRadius(DependencyObject obj) { return (CornerRadius)obj.GetValue(CornerRadiusProperty); } /// /// Sets a value that represents the degree to which the corners of a control border are rounded. /// public static void SetCornerRadius(DependencyObject obj, CornerRadius value) { obj.SetValue(CornerRadiusProperty, value); } public static readonly DependencyProperty BorderStyleProperty = DependencyProperty.RegisterAttached( "BorderStyle", typeof(BorderStyle), typeof(AntdControl), new PropertyMetadata(BorderStyle.Solid)); /// /// Gets the style of the control border. /// public static BorderStyle GetBorderStyle(DependencyObject obj) { return (BorderStyle)obj.GetValue(BorderStyleProperty); } /// /// Sets the style of the control border. /// public static void SetBorderStyle(DependencyObject obj, BorderStyle value) { obj.SetValue(BorderStyleProperty, value); } #endregion #region Size public static readonly DependencyProperty SizeProperty = DependencyProperty.RegisterAttached( "Size", typeof(Sizes?), typeof(AntdControl), new PropertyMetadata(null)); /// /// Gets the size of the control. /// public static Sizes? GetSize(DependencyObject obj) { return (Sizes?)obj.GetValue(SizeProperty); } /// /// Sets the size of the control. /// public static void SetSize(DependencyObject obj, Sizes? value) { obj.SetValue(SizeProperty, value); } #endregion #region Brushes public static readonly DependencyProperty MouseOverForegroundProperty = DependencyProperty.RegisterAttached( "MouseOverForeground", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the foreground for controls in mouse over. /// public static Brush GetMouseOverForeground(DependencyObject obj) { return (Brush)obj.GetValue(MouseOverForegroundProperty); } /// /// Gets the foreground for controls in mouse over. /// public static void SetMouseOverForeground(DependencyObject obj, Brush value) { obj.SetValue(MouseOverForegroundProperty, value); } public static readonly DependencyProperty MouseOverBorderBrushProperty = DependencyProperty.RegisterAttached( "MouseOverBorderBrush", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the border brush for controls in mouse over. /// public static Brush GetMouseOverBorderBrush(DependencyObject obj) { return (Brush)obj.GetValue(MouseOverBorderBrushProperty); } /// /// Sets the border brush for controls in mouse over. /// public static void SetMouseOverBorderBrush(DependencyObject obj, Brush value) { obj.SetValue(MouseOverBorderBrushProperty, value); } public static readonly DependencyProperty MouseOverBackgroundProperty = DependencyProperty.RegisterAttached( "MouseOverBackground", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the background brush for controls in mouse over. /// public static Brush GetMouseOverBackground(DependencyObject obj) { return (Brush)obj.GetValue(MouseOverBackgroundProperty); } /// /// Sets the background brush for controls in mouse over. /// public static void SetMouseOverBackground(DependencyObject obj, Brush value) { obj.SetValue(MouseOverBackgroundProperty, value); } public static readonly DependencyProperty FocusedForegroundProperty = DependencyProperty.RegisterAttached( "FocusedForeground", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the foreground for controls in focused. /// public static Brush GetFocusedForeground(DependencyObject obj) { return (Brush)obj.GetValue(FocusedForegroundProperty); } /// /// Gets the foreground for controls in focused. /// public static void SetFocusedForeground(DependencyObject obj, Brush value) { obj.SetValue(FocusedForegroundProperty, value); } public static readonly DependencyProperty FocusedBorderBrushProperty = DependencyProperty.RegisterAttached( "FocusedBorderBrush", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the border brush for controls in focused. /// public static Brush GetFocusedBorderBrush(DependencyObject obj) { return (Brush)obj.GetValue(FocusedBorderBrushProperty); } /// /// Sets the border brush for controls in focused. /// public static void SetFocusedBorderBrush(DependencyObject obj, Brush value) { obj.SetValue(FocusedBorderBrushProperty, value); } public static readonly DependencyProperty FocusedBackgroundProperty = DependencyProperty.RegisterAttached( "FocusedBackground", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the background brush for controls in focused. /// public static Brush GetFocusedBackground(DependencyObject obj) { return (Brush)obj.GetValue(FocusedBackgroundProperty); } /// /// Sets the background brush for controls in focused. /// public static void SetFocusedBackground(DependencyObject obj, Brush value) { obj.SetValue(FocusedBackgroundProperty, value); } public static readonly DependencyProperty PressedForegroundProperty = DependencyProperty.RegisterAttached( "PressedForeground", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the foreground for controls in pressed. /// public static Brush GetPressedForeground(DependencyObject obj) { return (Brush)obj.GetValue(PressedForegroundProperty); } /// /// Gets the foreground for controls in pressed. /// public static void SetPressedForeground(DependencyObject obj, Brush value) { obj.SetValue(PressedForegroundProperty, value); } public static readonly DependencyProperty PressedBorderBrushProperty = DependencyProperty.RegisterAttached( "PressedBorderBrush", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the border brush for controls in pressed. /// public static Brush GetPressedBorderBrush(DependencyObject obj) { return (Brush)obj.GetValue(PressedBorderBrushProperty); } /// /// Sets the border brush for controls in pressed. /// public static void SetPressedBorderBrush(DependencyObject obj, Brush value) { obj.SetValue(PressedBorderBrushProperty, value); } public static readonly DependencyProperty PressedBackgroundProperty = DependencyProperty.RegisterAttached( "PressedBackground", typeof(Brush), typeof(AntdControl), new FrameworkPropertyMetadata( Brushes.Transparent, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits )); /// /// Gets the background brush for controls in pressed. /// public static Brush GetPressedBackground(DependencyObject obj) { return (Brush)obj.GetValue(PressedBackgroundProperty); } /// /// Sets the background brush for controls in pressed. /// public static void SetPressedBackground(DependencyObject obj, Brush value) { obj.SetValue(PressedBackgroundProperty, value); } #endregion } }