Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted

After much effort and time, I've gotten the collection editor to properly work with a collection property (Items) on a control I've written. The only problem I am having now is that when I delete the control in the designer, the components that were assigned to the Items property are not being deleted with the control.

 

For instance, if you create a TabControl and add multiple TabPage components to the TabPages property, then delete the TabControl, the TabPage components disappear with it. When I delete my control, the items are not deleted. They remain in the designer generated code and in the drop down list at the top of the property grid.

 

Some declarations:

// Collection Item Class Declaration
[DesignTimeVisible(false), ToolboxItem(false)]
public class CollectionItem:Component
{
}

// Collection Class Declaration
public class Collection:IList<CollectionItem>, IList
{  // The designer uses the non-generic IList implementation
}  // to manage the collection at design time.

// Collection Property Declaration
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),     // Treat property as collection
Editor(typeof(CollectionEditor), typeof(System.Drawing.Design.UITypeEditor) )] // Edit with the generic collection editor
public Collection Items { get { return items; } }

 

If anyone has any tips or suggestions they would be appreciated.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...