using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace CustomUI { public enum CheckBoxSkinsEnum { /// /// 方形的CheckBox /// DefaultSquare, /// /// 圆形的CheckBox /// DefaultEllipse, EllipseSkin1, } public class FlatCheckBox : CheckBox { static FlatCheckBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(FlatCheckBox), new FrameworkPropertyMetadata(typeof(FlatCheckBox))); } #region 依赖属性 public static readonly DependencyProperty SkinsProperty = DependencyProperty.Register("Skins" , typeof(CheckBoxSkinsEnum), typeof(FlatCheckBox), new PropertyMetadata(CheckBoxSkinsEnum.DefaultSquare)); /// /// CheckBox皮肤样式 /// public CheckBoxSkinsEnum Skins { get { return (CheckBoxSkinsEnum)GetValue(SkinsProperty); } set { SetValue(SkinsProperty, value); } } public static readonly DependencyProperty UnCheckedColorProperty = DependencyProperty.Register("UnCheckedColor" , typeof(Brush), typeof(FlatCheckBox)); /// /// CheckBox未选中时的颜色 /// public Brush UnCheckedColor { get { return (Brush)GetValue(UnCheckedColorProperty); } set { SetValue(UnCheckedColorProperty, value); } } public static readonly DependencyProperty CheckedColorProperty = DependencyProperty.Register("CheckedColor" , typeof(Brush), typeof(FlatCheckBox)); /// /// CheckBox选中后的颜色 /// public Brush CheckedColor { get { return (Brush)GetValue(CheckedColorProperty); } set { SetValue(CheckedColorProperty, value); } } #endregion } }