Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this class Inherited from ColumnHeader

Public Class xcolumnheader

   Inherits ColumnHeader

   <Browsable(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
   Public Property CP As New CollectionOfProperties

   Public Class CollectionOfProperties

       <Browsable(True)>
       Public Property Property1 As Boolean

       <Browsable(True)>
       Public Property Property2 As String

       <Browsable(True)>
       Public Property Property3 As Integer

   End Class

End Class


I want the CP property to be editable from the desinger (LIKE editing font of control)

What I have tried:

I tried searching but didn't find how do to it
Posted
Updated 12-Aug-18 9:22am

1 solution

You only have to add the ExpandableObjectConverter as TypeConverter to your class :
VB
Imports System.ComponentModel

Public Class xColumnHeader
    Inherits ColumnHeader

    <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
    Public Property CP As New CollectionOfProperties

    <TypeConverter(GetType(ExpandableObjectConverter))>
    Public Class CollectionOfProperties

        Public Property Property1 As Boolean

        Public Property Property2 As String

        Public Property Property3 As Integer

    End Class

End Class


Additional :
You don't need the Browsable-Attribute at your Properties - each Property is normally allways 'browsable'. You only need this Attribute if you want that you Property is NOT browsable ...
 
Share this answer
 
v2
Comments
Eng Ahmed Taha 13-Aug-18 12:20pm    
It works … thank you
Ralf Meier 14-Aug-18 13:25pm    
Afwan ... you're welcome ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900