내 proget (C#)에서 mvvm 패턴을 사용하는데 문제가 있습니다. 내보기에 라벨이 있고, 라벨의 텍스트는 내 뷰 모델에서 속성에 바인더 제본되어이에서 INotifyPropertyChanged 인터페이스를 구현하는 내보기 모델,다른 정적 속성을 사용하는 속성을 바인딩하는 방법
val label=new Label();
label.SetBinding<StatusViewModel>(Label.TextProperty, x=>x.TextProp);
입니다 :
class StatusViewModel
{
private string _textProp;
public string TextProp
{
get
{
return _textProp;
}
set
{
if(_textProp == value)
return _textProp;
_textProp=value;
OnPropertyChange();
}
}
}
는하지만 다른 정적이 특성 :
static class StaticClass
{
public static string StaticText {get; set; }
}
내가 StatusViewModel에서 내 TextProp 속성 내에서이 정적 속성의 StaticText를 사용합니다. 그리고 그것에 대한 StaticText 속성 마스트 레이블 변경 알림.
P. 가능한 실수에 대해 유감스럽게 생각하고, 나는이 코드를 내 머리 속에서 입력했다. 당신이 static
속성에 바인딩하는 경우
세터에서 신고서를 받았습니다. – Will