Search Results

Search found 1 results on 1 pages for 'gkar'.

Page 1/1 | 1 

  • WPF Prism's delegatecommand not refreshing

    - by gkar
    I am building wpf edit form, that has two buttons, BeginEdit and Save And the form is bound to ViewModel that inherits from Prism's NotificationObject. There is a property called IsReadOnly And there are two commands that are Prism's DelegateCommands BeginEdit command and save command The code is here private DelegateCommand _beginEdit; public DelegateCommand BeginEdit { get { return _beginEdit ?? (_beginEdit = new DelegateCommand(() => this.IsReadOnly = false , () => IsReadOnly)); } } private bool _isReadOnly; public bool IsReadOnly { get { return _isReadOnly; } set { _isReadOnly = value; RaisePropertyChanged("IsReadOnly"); } } private DelegateCommand _saveEdit; public DelegateCommand SaveEdit { get { return _saveEdit ?? (_saveEdit = new DelegateCommand(() => this.IsReadOnly = true , () => !IsReadOnly)); } } So, as you see, the command will set IsReadOnly property to true or false, and CanExecute should get its value from the same property as well. It works when I start the form. But after I press BeginEdit, the buttons stays as the same, and the canExecute is not reflecting the new value of IsReadOnly

    Read the article

1