PropertyGrid / CollectionEditor doesn`t call my Add- Methode  
Author Message
Glassghost





PostPosted: .NET Base Class Library, PropertyGrid / CollectionEditor doesn`t call my Add- Methode Top

Hello,

I'll try do describe my problem: I'm developing an application to draw/export class diagrams using C#, .Net Framework 1.1.

To let the user edit the properties of a class or relation, I'm using the PropertyGrid- Control.
Since my class- objects are UserControls, they have many properties inherited I don't want to show in the PropertyGrid.

For that reason I built wrapper- classes, which only own the properties I want to offer. Some of these properties, e.g. the operations or attributes of a class, are realized in the original UserControl- class as hashtable. To display these hashtables, I built own Collection classes (which extends the System.Collections.CollectionBase- class), so you can say that these are kind of wrapper classes for the hashtable properties.
It all works fine, except the adding and deleting of elements from the hashtables.
I use CollectionEditor in the PropertyGrid to display my "wrapper-collections". But when I press the "Add" or "Remove" Button inside the CollectionEditor, my implementation of the IList- Interface (Add / AddRange) inside my wrapper-collection is never called, so I don't know how I can add or delete the element also to/from the hashtable of the original object.

The adding and deleting at my wrapper- collection works fine, so I want to know, how the CollectionEditor manages it, to add a element to my own Collection without using my Add- Methode

Man, I hope my english isn't that bad and someone can understand my problem.

Best greetings,
Bob


.NET Development35  
 
 
nobugz





PostPosted: .NET Base Class Library, PropertyGrid / CollectionEditor doesn`t call my Add- Methode Top

CollectionBase doesn't have an Add() method. Try overriding the OnInsert() method.