2017-11-02 2 views
0

코드에서 정적 속성에 INotifyPropertyChanged을 구현했습니다. 하지만 UI에는 영향을 미치지 않습니다. 여기에 내 코드를 추가했습니다. 누구나 이것에 대한 아이디어가 있습니다. 미리 감사드립니다. 난 당신이 'X : 정적'를 사용하고 있기 때문에 당신의 'LoginPageModel'클래스뿐만 아니라 정적 있으리라 믿고있어xamarin 양식의 정적 속성에 대해 INotifyPropertyChanged가 작동하지 않습니다.

 private static string dateTimeValue; 
    public static string DateTimeValue { get { return dateTimeValue; } set 
     { dateTimeValue = value; RaisedPropertyChanged("DateTimeValue"); } } 

    static void RaisedPropertyChanged([CallerMemberName] string name = null) 
    { 
     if (PropertyChanged != null) 
      PropertyChanged(null, new PropertyChangedEventArgs(name)); 
    } 
The xaml code is, 
    <Label Text="{Binding Source={x:Static local:LoginPageModel.DateTimeValue}, UpdateSourceEventName=PropertyChanged}"> 

답변

1

이 경우, 태그 확장, 당신의 코드는 'UpdateSourceEventName =하여 PropertyChanged'를 제외하고 올바른 보인다 필요하지 않으며 이로 인해 UI가 업데이트되지 않을 수 있습니다.

관련 문제