ICommand CanExecuteChanged not updating

前端 未结 2 791
慢半拍i
慢半拍i 2021-01-19 05:28

I am trying for MVVM pattern basic level and got struck at ICommand CanExecute changed. I have XAML binding as follows:

    

        
2条回答
  •  失恋的感觉
    2021-01-19 06:16

    You must have in your ICommand implementation some method like RiseCanExecuteChanged that fires the event CanExecuteChanged. Then every time that the selected item in the list changed, in your view model you execute the RaiseCanExecuteChanged from the command you want. Any way I suggest you to use any generic command, like the RelayCommand of GalaSoft MVVMLite library, or any implementation of DelegateCommand. Hope this helps...

提交回复
热议问题