0

CommandManager.InvalidateRequerySuggested() is called automatically every time a key has been pressed, when the focus has changed etc. I'd like to prevent this from happening under certain conditions (for example only call it when keys pressed are not Up or Down) and do my own handling of RoutedCommands, because InvalidateRequerySuggested() always processes all commands and is a bit slow.

I can see in the reference source where InvalidateRequerySuggested is called, but I don't see a way to intervene there. There is a PreProcessInput event, but the necessary information you'd need from it is hidden in internal classes like InputReportEventArgs.

Is there a way?

floele
  • 3,668
  • 4
  • 35
  • 51
  • In general, to determine whether an `ICommand` is enabled or not, we handle the `CanExecute` method. Also, you should be careful about changing the default way that certain functionality works... you could really annoy your users that will be expecting normal behaviour. – Sheridan Apr 24 '14 at 12:37
  • @Sheridan I want to continue using `CanExecute`. And there is no change in UI behaviour either (other than it being faster). I just want to do something manually that is done automatically otherwise. – floele Apr 24 '14 at 13:38
  • Ok, well good luck with that. – Sheridan Apr 24 '14 at 14:14

0 Answers0