Can I raise CanExecute on MediaCommands without using InvalidateRequerySposed ()?

I have some custom CommandBindings that define CanExecute status for various MediaCommands (Play, Pause, etc.). I would like to call the CanExecute handler to call at specific points. However, the only way to figure out how to do this is InvalidateRequerySposed (), which forces everyone to recount CanExecute. This is excessive and slow, so I would like to find a better and more focused way to update CanExecute in these commands.

It seems that if I used a delegate computer, I could do this by calling RaiseCanExecuteChanged, but I would like to do this with existing MediaCommands, if possible.

If there are no direct ways to do this, are there any hacker workarounds? I noticed that there is some intelligence when recounting CanExecute inside (e.g. displaying UIElements for the first time, etc.)

+3
source share

All Articles