1
我正在實現PropertyChangedEventHandler PropertyChanged並且它始終爲空。 屬性字符串是正確的唐諾這裏是哪裏的問題 是代碼我使用PropertyChangedEventHandler PropertyChanged爲null
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的方法,您應該閱讀[this](https://blogs.msdn.microsoft.com/ericlippert/2009/04/29/events-and-races/) – 2016-11-11 10:07:33