| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- namespace SKMC.UI.CustomControls
- {
- public class SKTextBox : TextBox
- {
- static SKTextBox()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(SKTextBox), new FrameworkPropertyMetadata(typeof(SKTextBox)));
- }
- public string Label
- {
- get { return (string)GetValue(LabelProperty); }
- set { SetValue(LabelProperty, value); }
- }
- /// <summary>
- /// 单位
- /// </summary>
- public string Unit
- {
- get { return (string)GetValue(UnitProperty); }
- set { SetValue(UnitProperty, value); }
- }
- /// <summary>
- /// 单位字体大小
- /// </summary>
- public double UnitSize
- {
- get { return (double)GetValue(UnitSizeProperty); }
- set { SetValue(UnitSizeProperty, value); }
- }
- /// <summary>
- /// 值是否有效
- /// </summary>
- public bool IsValueValid
- {
- get { return (bool)GetValue(IsValueValidProperty); }
- set { SetValue(IsValueValidProperty, value); }
- }
- /// <summary>
- /// 最大值
- /// </summary>
- public object MaxValue
- {
- get { return (object)GetValue(MaxValueProperty); }
- set { SetValue(MaxValueProperty, value); }
- }
- /// <summary>
- /// 最小值
- /// </summary>
- public object MinValue
- {
- get { return (object)GetValue(MinValueProperty); }
- set { SetValue(MinValueProperty, value); }
- }
- /// <summary>
- /// 圆角
- /// </summary>
- public CornerRadius CornerRadius
- {
- get { return (CornerRadius)GetValue(CornerRadiusProperty); }
- set { SetValue(CornerRadiusProperty, value); }
- }
- public string ToolTipComment
- {
- get { return (string)GetValue(ToolTipCommentProperty); }
- set { SetValue(ToolTipCommentProperty, value); }
- }
- /// <summary>
- /// 图标
- /// </summary>
- public Geometry Icon
- {
- get { return (Geometry)GetValue(IconProperty); }
- set { SetValue(IconProperty, value); }
- }
- public double IconSize
- {
- get { return (double)GetValue(IconSizeProperty); }
- set { SetValue(IconSizeProperty, value); }
- }
- public static readonly DependencyProperty IconProperty =
- DependencyProperty.Register("Icon", typeof(Geometry), typeof(SKTextBox), new PropertyMetadata(null));
- public static readonly DependencyProperty ToolTipCommentProperty =
- DependencyProperty.Register("ToolTipComment", typeof(string), typeof(SKTextBox), new PropertyMetadata(null));
- public static readonly DependencyProperty CornerRadiusProperty =
- DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(SKTextBox), new PropertyMetadata(new CornerRadius(0)));
- public static readonly DependencyProperty MinValueProperty =
- DependencyProperty.Register("MinValue", typeof(object), typeof(SKTextBox), new PropertyMetadata(null));
- public static readonly DependencyProperty MaxValueProperty =
- DependencyProperty.Register("MaxValue", typeof(object), typeof(SKTextBox), new PropertyMetadata(null));
- public static readonly DependencyProperty IsValueValidProperty =
- DependencyProperty.Register("IsValueValid", typeof(bool), typeof(SKTextBox), new PropertyMetadata(true));
- public static readonly DependencyProperty UnitProperty =
- DependencyProperty.Register("Unit", typeof(string), typeof(SKTextBox), new PropertyMetadata(""));
- public static readonly DependencyProperty LabelProperty =
- DependencyProperty.Register("Label", typeof(string), typeof(SKTextBox), new PropertyMetadata(""));
- public static readonly DependencyProperty UnitSizeProperty =
- DependencyProperty.Register("UnitSize", typeof(double), typeof(SKTextBox), new PropertyMetadata(10.0));
- public static readonly DependencyProperty IconSizeProperty =
- DependencyProperty.Register(nameof(IconSize), typeof(double), typeof(SKTextBox), new PropertyMetadata(10.0));
- }
- }
|