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.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace PDF_Office.CustomControl { /// /// TextBoxWithTip.xaml 的交互逻辑 /// 带有tip文字的TextBox /// public partial class TextBoxWithTip : UserControl { public TextBoxWithTip() { InitializeComponent(); } public string TipText { get { return (string)GetValue(TipTextProperty); } set { SetValue(TipTextProperty, value); } } // Using a DependencyProperty as the backing store for TipText. This enables animation, styling, binding, etc... public static readonly DependencyProperty TipTextProperty = DependencyProperty.Register("TipText", typeof(string), typeof(TextBoxWithTip), new PropertyMetadata("")); public Visibility ShowTip { get { return (Visibility)GetValue(ShowTipProperty); } set { SetValue(ShowTipProperty, value); } } // Using a DependencyProperty as the backing store for ShowTip. This enables animation, styling, binding, etc... public static readonly DependencyProperty ShowTipProperty = DependencyProperty.Register("ShowTip", typeof(Visibility), typeof(TextBoxWithTip), new PropertyMetadata(Visibility.Hidden)); public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } // Using a DependencyProperty as the backing store for Text. This enables animation, styling, binding, etc... public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(TextBoxWithTip), new PropertyMetadata("")); public string PlaceHoldText { get { return (string)GetValue(PlaceHoldTextProperty); } set { SetValue(PlaceHoldTextProperty, value); } } // Using a DependencyProperty as the backing store for PlaceHoldText. This enables animation, styling, binding, etc... public static readonly DependencyProperty PlaceHoldTextProperty = DependencyProperty.Register("PlaceHoldText", typeof(string), typeof(TextBoxWithTip), new PropertyMetadata("")); public bool IsError { get { return (bool)GetValue(IsErrorProperty); } set { SetValue(IsErrorProperty, value); } } // Using a DependencyProperty as the backing store for IsError. This enables animation, styling, binding, etc... public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(TextBoxWithTip), new PropertyMetadata(false)); } }