using System.Windows;
using System.Windows.Media;
namespace BPA.UIControl
{
///
/// 标题帮助类
///
public class HeaderHelper
{
///
/// 背景色
///
public static readonly DependencyProperty BackgroundProperty =
DependencyProperty.RegisterAttached("Background", typeof(Brush), typeof(HeaderHelper), new PropertyMetadata(default));
///
/// Gets the background.
///
/// The obj.
/// A Brush.
public static Brush GetBackground(DependencyObject obj)
{
return (Brush)obj.GetValue(BackgroundProperty);
}
///
/// Sets the background.
///
/// The obj.
/// The value.
public static void SetBackground(DependencyObject obj, Brush value)
{
obj.SetValue(BackgroundProperty, value);
}
///
/// 前景色
///
public static readonly DependencyProperty ForegroundProperty =
DependencyProperty.RegisterAttached("Foreground", typeof(Brush), typeof(HeaderHelper), new PropertyMetadata(default));
///
/// Gets the foreground.
///
/// The obj.
/// A Brush.
public static Brush GetForeground(DependencyObject obj)
{
return (Brush)obj.GetValue(ForegroundProperty);
}
///
/// Sets the foreground.
///
/// The obj.
/// The value.
public static void SetForeground(DependencyObject obj, Brush value)
{
obj.SetValue(ForegroundProperty, value);
}
///
/// 字体
///
public static readonly DependencyProperty FontFamilyProperty =
DependencyProperty.RegisterAttached("FontFamily", typeof(FontFamily), typeof(HeaderHelper), new PropertyMetadata(SystemFonts.CaptionFontFamily));
///
/// Gets the font family.
///
/// The obj.
/// A FontFamily.
public static FontFamily GetFontFamily(DependencyObject obj)
{
return (FontFamily)obj.GetValue(FontFamilyProperty);
}
///
/// Sets the font family.
///
/// The obj.
/// The value.
public static void SetFontFamily(DependencyObject obj, FontFamily value)
{
obj.SetValue(FontFamilyProperty, value);
}
///
/// 字体大小
///
public static readonly DependencyProperty FontSizeProperty =
DependencyProperty.RegisterAttached("FontSize", typeof(double), typeof(HeaderHelper), new PropertyMetadata(SystemFonts.CaptionFontSize));
///
/// Gets the font size.
///
/// The obj.
/// A double.
public static double GetFontSize(DependencyObject obj)
{
return (double)obj.GetValue(FontSizeProperty);
}
///
/// Sets the font size.
///
/// The obj.
/// The value.
public static void SetFontSize(DependencyObject obj, double value)
{
obj.SetValue(FontSizeProperty, value);
}
///
/// 字体加粗
///
public static readonly DependencyProperty FontWeightProperty =
DependencyProperty.RegisterAttached("FontWeight", typeof(FontWeight), typeof(HeaderHelper), new PropertyMetadata(SystemFonts.CaptionFontWeight));
///
/// Gets the font weight.
///
/// The obj.
/// A FontWeight.
public static FontWeight GetFontWeight(DependencyObject obj)
{
return (FontWeight)obj.GetValue(FontWeightProperty);
}
///
/// Sets the font weight.
///
/// The obj.
/// The value.
public static void SetFontWeight(DependencyObject obj, FontWeight value)
{
obj.SetValue(FontWeightProperty, value);
}
///
/// padding
///
public static readonly DependencyProperty PaddingProperty =
DependencyProperty.RegisterAttached("Padding", typeof(Thickness), typeof(HeaderHelper), new PropertyMetadata(default));
///
/// Gets the padding.
///
/// The obj.
/// A Thickness.
public static Thickness GetPadding(DependencyObject obj)
{
return (Thickness)obj.GetValue(PaddingProperty);
}
///
/// Sets the padding.
///
/// The obj.
/// The value.
public static void SetPadding(DependencyObject obj, Thickness value)
{
obj.SetValue(PaddingProperty, value);
}
///
/// margin
///
public static readonly DependencyProperty MarginProperty =
DependencyProperty.RegisterAttached("Margin", typeof(Thickness), typeof(HeaderHelper), new PropertyMetadata(default));
///
/// Gets the margin.
///
/// The obj.
/// A Thickness.
public static Thickness GetMargin(DependencyObject obj)
{
return (Thickness)obj.GetValue(MarginProperty);
}
///
/// Sets the margin.
///
/// The obj.
/// The value.
public static void SetMargin(DependencyObject obj, Thickness value)
{
obj.SetValue(MarginProperty, value);
}
///
/// 水平对齐
///
public static readonly DependencyProperty HorizontalAlignmentProperty =
DependencyProperty.RegisterAttached("HorizontalAlignment", typeof(HorizontalAlignment), typeof(HeaderHelper), new PropertyMetadata(default));
///
/// Gets the horizontal alignment.
///
/// The obj.
/// A HorizontalAlignment.
public static HorizontalAlignment GetHorizontalAlignment(DependencyObject obj)
{
return (HorizontalAlignment)obj.GetValue(HorizontalAlignmentProperty);
}
///
/// Sets the horizontal alignment.
///
/// The obj.
/// The value.
public static void SetHorizontalAlignment(DependencyObject obj, HorizontalAlignment value)
{
obj.SetValue(HorizontalAlignmentProperty, value);
}
///
/// 垂直对齐
///
public static readonly DependencyProperty VerticalAlignmentProperty =
DependencyProperty.RegisterAttached("VerticalAlignment", typeof(VerticalAlignment), typeof(HeaderHelper), new PropertyMetadata(default));
///
/// Gets the vertical alignment.
///
/// The obj.
/// A VerticalAlignment.
public static VerticalAlignment GetVerticalAlignment(DependencyObject obj)
{
return (VerticalAlignment)obj.GetValue(VerticalAlignmentProperty);
}
///
/// Sets the vertical alignment.
///
/// The obj.
/// The value.
public static void SetVerticalAlignment(DependencyObject obj, VerticalAlignment value)
{
obj.SetValue(VerticalAlignmentProperty, value);
}
///
/// 圆角半径
///
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached(
"CornerRadius", typeof(CornerRadius), typeof(HeaderHelper), new PropertyMetadata(default(CornerRadius)));
///
/// Sets the corner radius.
///
/// The element.
/// The value.
public static void SetCornerRadius(DependencyObject element, CornerRadius value)
{
element.SetValue(CornerRadiusProperty, value);
}
///
/// Gets the corner radius.
///
/// The element.
/// A CornerRadius.
public static CornerRadius GetCornerRadius(DependencyObject element)
{
return (CornerRadius)element.GetValue(CornerRadiusProperty);
}
}
}