PropertyChangedEventHandler PropertyChanged 为 null
我正在实现 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}}"
}
所以有人知道这个问题吗?
i am implementing PropertyChangedEventHandler PropertyChanged and it's always null.
property string is right donno where is the problem
here is the code i am using
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);
}
and in the xaml
Visibility="{Binding Path=AdsGridVisibility, Converter={StaticResource VC}}"
}
so can anyone knows the problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发生这种情况的原因之一是您的代码不处理原始数据上下文。您可能有视图模型的两份副本,并且您可能正在更新未绑定的一份。
One reason this could be happening is if your code does not deal with the original data context. You might have two copies of the view model and you might be updating the one that is not bound.