What replaces CommandManager in WinRT?

前端 未结 2 1090
眼角桃花
眼角桃花 2021-02-05 07:17

I\'m getting started with Metro style applications (I know we\'re not supposed to call it Metro, but I can never remember what it\'s supposed to be called...), and I\'m implemen

2条回答
  •  再見小時候
    2021-02-05 07:56

    In WinRT, you must update/raise CanExecuteChanged manually. There is no CommandManager to do this globally. You could look at this as a pain in the neck, or a serious performance boost now that CanExecute is not called constantly. It does mean you have to think about cascading property changes where before you did not have to. But this is how it is. Manual.

    public void RaiseCanExecuteChanged()
    {
        if (CanExecuteChanged != null)
            CanExecuteChanged(this, EventArgs.Empty);
    }
    

提交回复
热议问题