我使用Xceed PropertyGrid,效果很好,直到我设置绑定为null的属性。这应该清除属性网格,但事实并非如此。清除PropertyGrid需要做些什么吗?
XAML:
<xctkpg:PropertyGrid
IsCategorized="True"
NameColumnWidth="150"
SelectedObject="{Binding SelectedObject}"
ShowSearchBox="True"
ShowSortOptions="False"
ShowTitle="False" />
视图模型:
#region SelectedObject
private object _SelectedObject;
public object SelectedObject
{
get { return this._SelectedObject; }
set
{
if (this._SelectedObject != value)
{
this._SelectedObject = value;
RaisePropertyChanged(nameof(this.SelectedObject));
}
}
}
#endregion SelectedObject
代码中的其他地方:
this.SelectedObject = this.SomeObject; <--- the property grid is correctly populated
...
this.SelectedObject = null; <--- the property grid incorrectly remains populated