51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
|
|
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 UIStandard.Assets.Styles.Models
|
|||
|
|
{
|
|||
|
|
public class IconTextBox: Control
|
|||
|
|
{
|
|||
|
|
// 定义依赖属性:图标路径、提示文字、输入文本
|
|||
|
|
public static readonly DependencyProperty IconSourceProperty =
|
|||
|
|
DependencyProperty.Register("IconSource", typeof(ImageSource), typeof(IconTextBox));
|
|||
|
|
|
|||
|
|
public static readonly DependencyProperty HintTextProperty =
|
|||
|
|
DependencyProperty.Register("HintText", typeof(string), typeof(IconTextBox));
|
|||
|
|
|
|||
|
|
public static readonly DependencyProperty TextProperty =
|
|||
|
|
DependencyProperty.Register("Text", typeof(string), typeof(IconTextBox));
|
|||
|
|
|
|||
|
|
static IconTextBox()
|
|||
|
|
{
|
|||
|
|
DefaultStyleKeyProperty.OverrideMetadata(
|
|||
|
|
typeof(IconTextBox),
|
|||
|
|
new FrameworkPropertyMetadata(typeof(IconTextBox)));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 属性封装
|
|||
|
|
public ImageSource IconSource
|
|||
|
|
{
|
|||
|
|
get => (ImageSource)GetValue(IconSourceProperty);
|
|||
|
|
set => SetValue(IconSourceProperty, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public string HintText
|
|||
|
|
{
|
|||
|
|
get => (string)GetValue(HintTextProperty);
|
|||
|
|
set => SetValue(HintTextProperty, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public string Text
|
|||
|
|
{
|
|||
|
|
get => (string)GetValue(TextProperty);
|
|||
|
|
set => SetValue(TextProperty, value);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|