我正在实现PropertyChangedEventHandler PropertyChanged,它总是为空。属性字符串是正确的,问题在哪里?这里是我正在使用的代码
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}}"
}那么,有没有人知道问题所在?
发布于 2010-11-30 08:30:23
可能发生这种情况的一个原因是,您的代码不处理原始数据上下文。您可能有两个视图模型副本,并且您可能正在更新未绑定的副本。
https://stackoverflow.com/questions/3601183
复制相似问题