Binding PropertyChangedEventHandler PropertyChanged为空

Binding PropertyChangedEventHandler PropertyChanged为空,binding,silverlight-4.0,inotifypropertychanged,propertychanged,Binding,Silverlight 4.0,Inotifypropertychanged,Propertychanged,我正在实现PropertyChangedEventHandler PropertyChanged,它始终为空。 属性字符串是正确的donno问题出在哪里 这是我正在使用的代码 public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChan

我正在实现PropertyChangedEventHandler PropertyChanged,它始终为空。 属性字符串是正确的donno问题出在哪里 这是我正在使用的代码

public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

public bool _playerGridVisibility ;
        public bool PlayerGridVisibility
        {
            get { return _playerGridVisibility; }
            set
            {
                _playerGridVisibility = value;
                this.OnPropertyChanged(Strings.PlayerGridVisibilityString);
            }
在xaml中

Visibility="{Binding Path=AdsGridVisibility, Converter={StaticResource VC}}"
        }

那么有人知道这个问题吗?

发生这种情况的一个原因是,如果您的代码不处理原始数据上下文。您可能有两个视图模型副本,并且可能正在更新未绑定的副本。

发生这种情况的一个原因是您的代码没有处理原始数据上下文。您可能有两个视图模型副本,并且可能正在更新未绑定的副本。

关于处理OnPropertyChanged的方法,您应该阅读处理OnPropertyChanged的方法,您应该阅读