473,395 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Property Grid, Collection Editor and Generic List

ME
I have a property that is a generic list of type IAddress (List<IAddress>).
When I attempt to view this property using the Property Grid control it
plainly says "Collection" and offers the typical generic CollectionEditor
that ships with .NET to edit the property. The trouble comes up though when
I attempt to Add an item to the collection via the CollectionEditor.
Obviously the Collection editor can not create an IAddress object since it
is an interface. I want to be able to supply a constructable type to the
CollectionEditor that it can use instead of the interface when adding an
object to the collection. I am hoping I will not have to create a custom
UITypeEditor.

Is there a way to solve this problem given that I purposely want the
collection to be of type IAddress as it offers greater flexibility down the
road.

Thanks,

Matt
Sep 12 '07 #1
2 12474
It isn't hard to subclass:

http://msdn2.microsoft.com/en-us/library/9zky1t4k.aspx

Marc
Sep 12 '07 #2
Check out the link below

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials...d-control.aspx


"ME" <tr*********@comcast.netREMOVETHISwrote in message
news:L-******************************@comcast.com...
>I have a property that is a generic list of type IAddress (List<IAddress>).
When I attempt to view this property using the Property Grid control it
plainly says "Collection" and offers the typical generic CollectionEditor
that ships with .NET to edit the property. The trouble comes up though
when I attempt to Add an item to the collection via the CollectionEditor.
Obviously the Collection editor can not create an IAddress object since it
is an interface. I want to be able to supply a constructable type to the
CollectionEditor that it can use instead of the interface when adding an
object to the collection. I am hoping I will not have to create a custom
UITypeEditor.

Is there a way to solve this problem given that I purposely want the
collection to be of type IAddress as it offers greater flexibility down
the road.

Thanks,

Matt
Sep 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Simon | last post by:
Hi I have developed a custom webcontrol like a Table (A) with a rows collection property (collection derived from CollectionBase) where I put one or more custom webcontrol (B). I need to hide...
0
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
0
by: stulika19 | last post by:
Hi I am using Collection Editor in my Property Grid.When I change value of a property in the property grid, the PropertyValueChanged event is raised and and I am able to execute certain lines of...
0
by: crazyone | last post by:
I've got a gaming framework i'm building and i want to save myself the trouble of reading and writting the complete game data to a custom file and load/save it to an XML file but i'm getting...
2
by: jbaldi | last post by:
I am trying to use a collection editor to edit multiple types as in the following example: ...
1
by: timnels | last post by:
I have a control that is subclassing a label control and I want to a a property that is a List of a custom class. The collection editor _seems_ to work fine. I can add new items to the list and it...
2
by: michelqa | last post by:
Hi, I'm trying to display a list of string in the string collection editor just like the "items" property of an ListBox in VS IDE.... I can find many examples on the net but I cant find any...
1
by: asharda | last post by:
I have a custom property grid. I am using custom property grid as I do not want the error messages that the propertygrid shows when abphabets are entered in interger fields. The custom property...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.