Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

PropertyGrid support for Collections (Divil ???)

 

Hi,

 

I am extending on a comboBoX control to write my own control. This new control has a property that is a Collection of string ... I want to display this in the prperty grid ... so I added the [browsable] attribute to the property in the extended class ...

 

the collection is displayed in the property grid ... but when i click on the ellipsis (...) in the property grid and try to add a new item in the design mode ... it doesn't allow me to do so ... sometimes, the Add button is disabled ... some other times "Add" is enabled ... but when the object gets added ... it cant be edited ... and throws and exception ...

 

anyone tried this before ?

 

Thanks,

Nish

  • *Gurus*
Posted

If you want a collection to be treated as an array of strings by Visual Studio like the ListBox's Items property is, apply this attribute to it:

 

Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

UNRESOLVED ...

 

Hi Divil,

 

Actually I have a NameValueCollection ... so i need another kind of collection editor ... i already got the stringcollectioneditor working, but its not enough when using a namevaluecollection in the control ...

 

Thanks,

Nish

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...