Hi,
I'm trying to create a PropertyGrid custom editor for the collections like ObservableCollection<T>.
![Image]()
But the problem is that PropertyGrid control does not know about any changes in my editor.
How to tell the parent property grid that collection property has changed?
I added a INotifyPropertyChanged interface to my editor
I can track collection changes, but can't find a way to notify Property grid about them.
Thanks in advance for any help,
Xandro.
I'm trying to create a PropertyGrid custom editor for the collections like ObservableCollection<T>.

But the problem is that PropertyGrid control does not know about any changes in my editor.
How to tell the parent property grid that collection property has changed?
I added a INotifyPropertyChanged interface to my editor
public partial class ListEditor : UserControl, ITypeEditor, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
PropertyItem _item;
public ListEditor()
{
InitializeComponent();
}
public FrameworkElement ResolveEditor(PropertyItem propertyItem)
{
_item = propertyItem;
if (_item.Value != null)
{
itemsList.ItemsSource = (ICollection)_item.Value;
((INotifyPropertyChanged)_item.Value).PropertyChanged += ListEditor_PropertyChanged;
}
return this;
}
void ListEditor_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
OnPropertyChanged("_item");
}
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
private void addItemBtn_Click(object sender, RoutedEventArgs e)
{
SingleItemEditor editor = new SingleItemEditor();
Type t = itemsList.ItemsSource.GetType().GetGenericArguments()[0];
Activator.CreateInstance(t);
if (editor.ShowDialog(Activator.CreateInstance(t)) == true)
{
((IList)itemsList.ItemsSource).Add(editor.item);
itemsList.Items.Refresh();
}
}
private void editItemBtn_Click(object sender, RoutedEventArgs e){}
private void delItemBtn_Click(object sender, RoutedEventArgs e){}
private void itemsList_SelectionChanged(object sender, SelectionChangedEventArgs e){}
}
It doesn't works as expected.I can track collection changes, but can't find a way to notify Property grid about them.
Thanks in advance for any help,
Xandro.