1
CanExecute 조건이 변경되면 RaiseCanExecuteChanged를 원합니다. 예컨대 :RaiseCanExecuteChanged more convenience
public class ViewModel
{
public viewModel()
{
Command = new RelayCommand(action,condition);
}
private bool condition()
{
return this.Condition1&&this.Condition2&&this.Condition3;
}
public bool Condition1
{
get{...}
set{.... **command.RaiseCanExecuteChanged();}**
}
public bool Condition2
{
get{...}
set{.... command.**RaiseCanExecuteChanged();}**
}
public bool Condition3
{
get{...}
set{.... **command.RaiseCanExecuteChanged();}**
}
}
잘 작동. 하지만 많은 수의 RaiseCanExecuteChanged를 쓰고 싶지는 않습니다.이 변경 사항을 자동으로 설정하고 싶습니다. RelayCommand에서 예 ,
public void RaiseChanged(XXXXXX XXX, params string[] propertyNames)
{
// for each property in propertyNames,
// RaiseCanExecuteChanged();
}
내가 매개 변수로 뷰 모델 VM을 넣어 RaiseChanged라는 새로운 방법을 만들고, vm.PropertyChanged + = (S, E) => {} 사용하지만 나는 생각하지 않는다 이것을하는 좋은 방법.
다른 아이디어가 있습니까?
C#보기 모델 : 나는 그렇게 할 수있는