You are right, it's works for simple property. See my second path in this post about refresh ExpandableObject.
public class SubClass: INotifyPropertyChanged
{
public string FirstName { get {...}; set {...; OnPropertyChanged("FirstName")}; }
public string LastName { get {...}; set {...; OnPropertyChanged("LastName")}; }
}
public class MyClass: INotifyPropertyChanged
{
[ExpandableObject]
[Editor(typeof(NameEditor), typeof(NameEditor))] // for refresh this value in PropertyGrid
public SubClass Name { get; set; }
}
// this not used PG for my property
public class NameEditor: Xceed.Wpf.Toolkit.PropertyGrid.Editors.ITypeEditor
{
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem)
{
TextBlock textBlock = new TextBlock();
var binding = new Binding("Value.FirstName");
binding.Source = propertyItem;
binding.ValidatesOnExceptions = true;
binding.ValidatesOnDataErrors = true;
binding.Mode = BindingMode.OneWay;
BindingOperations.SetBinding(textBlock, TextBlock.TextProperty, binding);
return textBlock;
}
}