/// <summary>
/// Controls的附加属性
/// </summary>
public class ControlsAttached : DependencyObject
{
public static CornerRadius GetCornerRadius(DependencyObject obj)
{
return (CornerRadius)obj.GetValue(CornerRadiusProperty);
}
public static void SetCornerRadius(DependencyObject obj, CornerRadius value)
{
obj.SetValue(CornerRadiusProperty, value);
}
// Using a DependencyProperty as the backing store for CornerRadius. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ControlsAttached), new PropertyMetadata(new CornerRadius()));
public static Thickness GetBorderThickness(DependencyObject obj)
{
return (Thickness)obj.GetValue(BorderThicknessProperty);
}
public static void SetBorderThickness(DependencyObject obj, Thickness value)
{
obj.SetValue(BorderThicknessProperty, value);
}
// Using a DependencyProperty as the backing store for BorderThickness. This enables animation, styling, binding, etc...
public static readonly DependencyProperty BorderThicknessProperty =
DependencyProperty.RegisterAttached("BorderThickness", typeof(Thickness), typeof(ControlsAttached), new PropertyMetadata(new Thickness()));
public static int GetControlTag(DependencyObject obj)
{
return (int)obj.GetValue(ControlTagProperty);
}
public static void SetControlTag(DependencyObject obj, int value)
{
obj.SetValue(ControlTagProperty, value);
}
// Using a DependencyProperty as the backing store for ControlTag. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ControlTagProperty =
DependencyProperty.RegisterAttached("ControlTag", typeof(int), typeof(ControlsAttached), new PropertyMetadata());
public static Visibility GetIsShowControl(DependencyObject obj)
{
return (Visibility)obj.GetValue(IsShowControlProperty);
}
public static void SetIsShowControl(DependencyObject obj, Visibility value)
{
obj.SetValue(IsShowControlProperty, value);
}
/// <summary>
/// 是否显示控件
/// </summary>
/// <param name="obj"></param>
/// <param name="value"></param>
// Using a DependencyProperty as the backing store for IsShowControl. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsShowControlProperty =
DependencyProperty.RegisterAttached("IsShowControl", typeof(Visibility), typeof(ControlsAttached), new PropertyMetadata(Visibility.Visible));
public static double GetAttachHeight(DependencyObject obj)
{
return (double)obj.GetValue(AttachHeightProperty);
}
public static void SetAttachHeight(DependencyObject obj, double value)
{
obj.SetValue(AttachHeightProperty, value);
}
// Using a DependencyProperty as the backing store for AttachHeight. This enables animation, styling, binding, etc...
public static readonly DependencyProperty AttachHeightProperty =
DependencyProperty.RegisterAttached("AttachHeight", typeof(double), typeof(ControlsAttached), new PropertyMetadata(double.NaN));
public static Brush GetMouseOverBackground(DependencyObject obj)
{
return (Brush)obj.GetValue(MouseOverBackgroundProperty);
}
public static void SetMouseOverBackground(DependencyObject obj, Brush value)
{
obj.SetValue(MouseOverBackgroundProperty, value);
}
// Using a DependencyProperty as the backing store for MouseOverBackground. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MouseOverBackgroundProperty =
DependencyProperty.RegisterAttached("MouseOverBackground", typeof(Brush), typeof(ControlsAttached), new PropertyMetadata(Brushes.Transparent));
public static Brush GetMouseOverBorderBrush(DependencyObject obj)
{
return (Brush)obj.GetValue(MouseOverBorderBrushProperty);
}
public static void SetMouseOverBorderBrush(DependencyObject obj, Brush value)
{
obj.SetValue(MouseOverBorderBrushProperty, value);
}
// Using a DependencyProperty as the backing store for MouseOverBorderBrush. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MouseOverBorderBrushProperty =
DependencyProperty.RegisterAttached("MouseOverBorderBrush", typeof(Brush), typeof(ControlsAttached), new PropertyMetadata(Brushes.Transparent));
public static Brush GetPressBackground(DependencyObject obj)
{
return (Brush)obj.GetValue(PressBackgroundProperty);
}
public static void SetPressBackground(DependencyObject obj, Brush value)
{
obj.SetValue(PressBackgroundProperty, value);
}
// Using a DependencyProperty as the backing store for PressBackground. This enables animation, styling, binding, etc...
public static readonly DependencyProperty PressBackgroundProperty =
DependencyProperty.RegisterAttached("PressBackground", typeof(Brush), typeof(ControlsAttached), new PropertyMetadata(Brushes.Transparent));
public static Brush GetPressBorderBrush(DependencyObject obj)
{
return (Brush)obj.GetValue(PressBorderBrushProperty);
}
public static void SetPressBorderBrush(DependencyObject obj, Brush value)
{
obj.SetValue(PressBorderBrushProperty, value);
}
// Using a DependencyProperty as the backing store for PressBorderBrush. This enables animation, styling, binding, etc...
public static readonly DependencyProperty PressBorderBrushProperty =
DependencyProperty.RegisterAttached("PressBorderBrush", typeof(Brush), typeof(ControlsAttached), new PropertyMetadata(Brushes.Transparent));
public static int GetControlEnable(DependencyObject obj)
{
return (int)obj.GetValue(ControlEnableProperty);
}
public static void SetControlEnable(DependencyObject obj, int value)
{
obj.SetValue(ControlEnableProperty, value);
}
// Using a DependencyProperty as the backing store for ControlEnable. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ControlEnableProperty =
DependencyProperty.RegisterAttached("ControlEnable", typeof(int), typeof(ControlsAttached), new PropertyMetadata());
public static VerticalAlignment GetVerticalAlignment(DependencyObject obj)
{
return (VerticalAlignment)obj.GetValue(VerticalAlignmentProperty);
}
public static void SetVerticalAlignment(DependencyObject obj, VerticalAlignment value)
{
obj.SetValue(VerticalAlignmentProperty, value);
}
// Using a DependencyProperty as the backing store for VerticalAlignment. This enables animation, styling, binding, etc...
public static readonly DependencyProperty VerticalAlignmentProperty =
DependencyProperty.RegisterAttached("VerticalAlignment", typeof(VerticalAlignment), typeof(ControlsAttached), new PropertyMetadata(VerticalAlignment.Stretch));
public static HorizontalAlignment GetHorizontalAlignment(DependencyObject obj)
{
return (HorizontalAlignment)obj.GetValue(HorizontalAlignmentProperty);
}
public static void SetHorizontalAlignment(DependencyObject obj, HorizontalAlignment value)
{
obj.SetValue(HorizontalAlignmentProperty, value);
}
// Using a DependencyProperty as the backing store for HorizontalAlignment. This enables animation, styling, binding, etc...
public static readonly DependencyProperty HorizontalAlignmentProperty =
DependencyProperty.RegisterAttached("HorizontalAlignment", typeof(HorizontalAlignment), typeof(ControlsAttached), new PropertyMetadata(HorizontalAlignment.Stretch));
}