我有一个WPF应用程序。如果我只按下按钮上的网格隐藏显示,那么它正在工作。但是如果我在下面编写任何代码,它就无法正常工作。
<Grid Margin="0">
<Grid x:Name="nonLoading" Margin="0" Visibility="{Binding Path=GridVisibility}">
</Grid>
private Visibility _gridVisibility = Visibility.Visible;
public Visibility GridVisibility
{
get
{
return _gridVisibility;
}
set
{
_gridVisibility = value;
}
}
我该如何解决这个问题?
答案 0 :(得分:1)
private Visibility _gridVisibility = Visibility.Visible;
public Visibility GridVisibility
{
get
{
return _gridVisibility;
}
set
{
_gridVisibility = value;
NotifyPropertyChanged();
}
}