all groups > dotnet windows forms > june 2003 >
You're in the

dotnet windows forms

group:

Collection property



Collection property Marc L'Ecuyer
6/27/2003 3:28:25 PM
dotnet windows forms: I want to implement a collection property inside another (in a control
derived class) but I have some persistence problems.

There is an example of my ColumnItem class

<TypeConverter(GetType(ColumnItemConverter))> _

Public Class ColumnItem

Private m_strText As String

Private m_intWidth As Integer

Private m_imgImage As Image

Private m_colValueItems As ValueItemsCollection

Public Sub New()

'...

End Sub

Public Property Text() As String

Get

Return m_strText

End Get

Set(ByVal Value As String)

m_strText = Value

End Set

End Property

Public Property Width() As Integer

Get

Return m_intWidth

End Get

Set(ByVal Value As Integer)

m_intWidth = Value

End Set

End Property

<Editor(GetType(CollectionEditor), GetType(UITypeEditor)), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _

Public ReadOnly Property ValueItems() As ValueItemsCollection

Get

Return m_colValueItems

End Get

End Property

'... other properties

End Class


I have a CollectionBase derived class object that contains all my
columnitems.
ValueItemsCollection is another CollectionBase derived class for my
sub-collection.
When I enter new columns in design time, nothing is serialized in the
InitializeComponent of the form.

Does anybody could send me some tips about how to do that?

Thanks

Re: Collection property Shawn Burke [MS]
6/27/2003 4:10:42 PM
You probably need to add InstanceDescriptors for your collection contents.
Read this and it should get you pointed in the right direction:


http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotne
t/html/custcodegen.asp?frame=true



--

Please do not reply to this alias directly. This posting is provided "AS
IS" with no warranties, and confers no rights. You assume all risk for your
use. © 2002 Microsoft Corporation. All rights reserved.


[quoted text, click to view]

AddThis Social Bookmark Button