Weird problem where Button does not get re-enabled unless the mouse is clicked

后端 未结 3 1768
时光取名叫无心
时光取名叫无心 2020-12-06 16:08

My app is written using the MVVM pattern in WPF, and all of my Buttons use Command bindings to execute code in my model. All commands have code in CanExecute to determine t

3条回答
  •  再見小時候
    2020-12-06 17:02

    Sometimes, setting the focus on the parent control makes the CommandManager trigger CanExecute. Try the following after setting Running to false:

    ...
    Running = false;
    parentControl.Focusable = true;
    parentControl.Focus();
    

提交回复
热议问题