TextBox.cs 433 B

1234567891011121314151617181920
  1. using System.Windows.Input;
  2. using HandyControl.Interactivity;
  3. namespace HandyControl.Controls;
  4. public class TextBox : System.Windows.Controls.TextBox
  5. {
  6. public TextBox()
  7. {
  8. CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) =>
  9. {
  10. if (IsReadOnly)
  11. {
  12. return;
  13. }
  14. SetCurrentValue(TextProperty, string.Empty);
  15. }));
  16. }
  17. }