HyperlinkButton.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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.Input;
  9. namespace FWindSoft.Wpf.Controls.CustomControl
  10. {
  11. public class HyperlinkButton:Control
  12. {
  13. static HyperlinkButton()
  14. {
  15. DefaultStyleKeyProperty.OverrideMetadata(typeof(HyperlinkButton),
  16. new FrameworkPropertyMetadata(typeof(HyperlinkButton)));
  17. }
  18. #region 依赖属性
  19. public static readonly DependencyProperty CommandProperty = DependencyProperty.Register("Command",
  20. typeof(ICommand),
  21. typeof(HyperlinkButton), new PropertyMetadata(null, null));
  22. /// <summary>
  23. /// 绑定命令
  24. /// </summary>
  25. public ICommand Command
  26. {
  27. get { return (ICommand)GetValue(CommandProperty); }
  28. set { SetValue(CommandProperty, value); }
  29. }
  30. #region 依赖属性
  31. public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text",
  32. typeof(string),
  33. typeof(HyperlinkButton), new PropertyMetadata(string.Empty, null));
  34. /// <summary>
  35. /// 显示文本
  36. /// </summary>
  37. public string ext
  38. {
  39. get { return (string)GetValue(TextProperty); }
  40. set { SetValue(TextProperty, value); }
  41. }
  42. #endregion
  43. #endregion
  44. }
  45. }