TextBoxWithTip.xaml.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace PDF_Master.CustomControl
  16. {
  17. /// <summary>
  18. /// TextBoxWithTip.xaml 的交互逻辑
  19. /// 带有tip文字的TextBox
  20. /// </summary>
  21. public partial class TextBoxWithTip : UserControl
  22. {
  23. public TextBoxWithTip()
  24. {
  25. InitializeComponent();
  26. }
  27. public string TipText
  28. {
  29. get { return (string)GetValue(TipTextProperty); }
  30. set { SetValue(TipTextProperty, value); }
  31. }
  32. // Using a DependencyProperty as the backing store for TipText. This enables animation, styling, binding, etc...
  33. public static readonly DependencyProperty TipTextProperty =
  34. DependencyProperty.Register("TipText", typeof(string), typeof(TextBoxWithTip), new PropertyMetadata(""));
  35. public Visibility ShowTip
  36. {
  37. get { return (Visibility)GetValue(ShowTipProperty); }
  38. set { SetValue(ShowTipProperty, value); }
  39. }
  40. // Using a DependencyProperty as the backing store for ShowTip. This enables animation, styling, binding, etc...
  41. public static readonly DependencyProperty ShowTipProperty =
  42. DependencyProperty.Register("ShowTip", typeof(Visibility), typeof(TextBoxWithTip), new PropertyMetadata(Visibility.Hidden));
  43. public string Text
  44. {
  45. get { return (string)GetValue(TextProperty); }
  46. set { SetValue(TextProperty, value); }
  47. }
  48. // Using a DependencyProperty as the backing store for Text. This enables animation, styling, binding, etc...
  49. public static readonly DependencyProperty TextProperty =
  50. DependencyProperty.Register("Text", typeof(string), typeof(TextBoxWithTip), new PropertyMetadata(""));
  51. public string PlaceHoldText
  52. {
  53. get { return (string)GetValue(PlaceHoldTextProperty); }
  54. set { SetValue(PlaceHoldTextProperty, value); }
  55. }
  56. // Using a DependencyProperty as the backing store for PlaceHoldText. This enables animation, styling, binding, etc...
  57. public static readonly DependencyProperty PlaceHoldTextProperty =
  58. DependencyProperty.Register("PlaceHoldText", typeof(string), typeof(TextBoxWithTip), new PropertyMetadata(""));
  59. public bool IsError
  60. {
  61. get { return (bool)GetValue(IsErrorProperty); }
  62. set { SetValue(IsErrorProperty, value); }
  63. }
  64. // Using a DependencyProperty as the backing store for IsError. This enables animation, styling, binding, etc...
  65. public static readonly DependencyProperty IsErrorProperty =
  66. DependencyProperty.Register("IsError", typeof(bool), typeof(TextBoxWithTip), new PropertyMetadata(false));
  67. }
  68. }