开发者

Can I Raise CanExecute on MediaCommands without using InvalidateRequerySuggested()?

开发者 https://www.devze.com 2023-03-09 16:37 出处:网络
I have some custom CommandBindings that determine the CanExecute status of various MediaCommands (Play, Pause, etc). I\'d like to trigger the CanExecute handler to be called at certain points. However

I have some custom CommandBindings that determine the CanExecute status of various MediaCommands (Play, Pause, etc). I'd like to trigger the CanExecute handler to be called at certain points. However, the only way I can figure out how to do this is with 开发者_StackOverflowInvalidateRequerySuggested(), which causes everything to recalculate its CanExecute. That's overkill and slow, so I'd like to figure out a better, more targeted way of updating CanExecute on these Commands.

It looks like if I used a DelegateCommand that I could do this by calling RaiseCanExecuteChanged, but I'd like to do it with the existing MediaCommands if possible.

If there aren't any direct ways of doing this, are there any hacky workarounds even? I've noticed that there is some intelligence at recalculating CanExecute internally (like showing UIElements for the first time, etc.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号