| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Media;
- namespace CustomUI.MyControls.Primitives
- {
- public class IconTextBoxBase : ZTextBoxBase
- {
- #region 依赖属性
- #region IsShowIcon
- /// <summary>
- /// 获取或者设置是否显示图标
- /// </summary>
- [Bindable(true), Description("获取或者设置是否显示图标")]
- public bool IsShowIcon
- {
- get { return (bool)GetValue(IsShowIconProperty); }
- set { SetValue(IsShowIconProperty, value); }
- }
- public static readonly DependencyProperty IsShowIconProperty =
- DependencyProperty.Register("IsShowIcon", typeof(bool), typeof(IconTextBoxBase), new PropertyMetadata(true));
- #endregion
-
- #region IconBackground
- /// <summary>
- /// 获取或者设置图标边框背景色
- /// </summary>
- [Bindable(true), Description("获取或者设置图标边框背景色")]
- public Brush IconBackground
- {
- get { return (Brush)GetValue(IconBackgroundProperty); }
- set { SetValue(IconBackgroundProperty, value); }
- }
- public static readonly DependencyProperty IconBackgroundProperty =
- DependencyProperty.Register("IconBackground", typeof(Brush), typeof(IconTextBoxBase));
- #endregion
- #region IconForeground
- /// <summary>
- /// 获取或者设置图标的颜色
- /// </summary>
- [Bindable(true), Description("获取或者设置图标的颜色")]
- public Brush IconForeground
- {
- get { return (Brush)GetValue(IconForegroundProperty); }
- set { SetValue(IconForegroundProperty, value); }
- }
- public static readonly DependencyProperty IconForegroundProperty =
- DependencyProperty.Register("IconForeground", typeof(Brush), typeof(IconTextBoxBase));
- #endregion
- #region IconBorderBrush
- /// <summary>
- /// 获取或者设置图标边框的颜色
- /// </summary>
- [Bindable(true), Description("获取或者设置图标边框背景色")]
- public Brush IconBorderBrush
- {
- get { return (Brush)GetValue(IconBorderBrushProperty); }
- set { SetValue(IconBorderBrushProperty, value); }
- }
- public static readonly DependencyProperty IconBorderBrushProperty =
- DependencyProperty.Register("IconBorderBrush", typeof(Brush), typeof(IconTextBoxBase));
- #endregion
- #region IconBorderThickness
- /// <summary>
- /// 获取或者设置图标边框的粗细与大小
- /// </summary>
- public Thickness IconBorderThickness
- {
- get { return (Thickness)GetValue(IconBorderThicknessProperty); }
- set { SetValue(IconBorderThicknessProperty, value); }
- }
- public static readonly DependencyProperty IconBorderThicknessProperty =
- DependencyProperty.Register("IconBorderThickness", typeof(Thickness), typeof(IconTextBoxBase));
- #endregion
- #region IconWidth
- /// <summary>
- /// 获取或者设置图标的大小
- /// </summary>
- [Bindable(true), Description("获取或者设置图标的大小")]
- public double IconWidth
- {
- get { return (double)GetValue(IconWidthProperty); }
- set { SetValue(IconWidthProperty, value); }
- }
- public static readonly DependencyProperty IconWidthProperty =
- DependencyProperty.Register("IconWidth", typeof(double), typeof(IconTextBoxBase));
- #endregion
- #region IconPadding
- /// <summary>
- /// 获取或者设置图标的内边距
- /// </summary>
- [Bindable(true), Description("获取或者设置图标的内边距")]
- public Thickness IconPadding
- {
- get { return (Thickness)GetValue(IconPaddingProperty); }
- set { SetValue(IconPaddingProperty, value); }
- }
- public static readonly DependencyProperty IconPaddingProperty =
- DependencyProperty.Register("IconPadding", typeof(Thickness), typeof(IconTextBoxBase));
- #endregion
- #region IconCornerRadius
- /// <summary>
- /// 获取或者设置图标边框的圆角(可以不用手动设置,系统会根据密码框的圆角值自动设置该值)
- /// </summary>
- [Bindable(true), Description("获取或者设置图标边框的圆角(可以不用手动设置,系统会根据密码框的圆角值自动设置该值)")]
- public CornerRadius IconCornerRadius
- {
- get { return (CornerRadius)GetValue(IconCornerRadiusProperty); }
- set { SetValue(IconCornerRadiusProperty, value); }
- }
- public static readonly DependencyProperty IconCornerRadiusProperty =
- DependencyProperty.Register("IconCornerRadius", typeof(CornerRadius), typeof(IconTextBoxBase));
- #endregion
- #region IconPathData
- /// <summary>
- /// 获取或者设置密码框图标
- /// </summary>
- [Bindable(true), Description("获取或者设置密码框图标")]
- public PathGeometry IconPathData
- {
- get { return (PathGeometry)GetValue(IconPathDataProperty); }
- set { SetValue(IconPathDataProperty, value); }
- }
- public static readonly DependencyProperty IconPathDataProperty =
- DependencyProperty.Register("IconPathData", typeof(PathGeometry), typeof(IconTextBoxBase));
- #endregion
- #endregion
- public override void OnCornerRadiusChanged(CornerRadius newValue)
- {
- this.SetValue(IconTextBoxBase.IconCornerRadiusProperty, new CornerRadius(newValue.TopLeft, 0, 0, newValue.BottomLeft));
- }
- }
- }
|