0

Is there any way to get notified BEFORE the text in a Windows::UI::Xaml::Controls::TextBox changes (TextChanged and TextChangedEventHandler work great to get notified AFTER the text changes)?

The functionality I am seeking would be loosely equivalent to iOS's shouldChangeCharactersInRange.

Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
Carl
  • 301
  • 4
  • 13

1 Answers1

1

You could store the previous Text value from the last TextChanged event in a field and if you are not happy with the new value on TextChanged - revert to the old value. Alternatively - you could indicate an error without actually preventing a value change.

Filip Skakun
  • 31,624
  • 6
  • 74
  • 100