Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi, I need a lot of help with this issue: I am developing a simple custom control. The control has a custom property. This custom property contains another custom property. I am not sure what is the right way to achieve it. The attached image says what I need to do.

When I change the width or color property at design or runtime, I can´t capture the change - it simply doesn´t update. The code I am using looks like this:

 

Public Class MyUC
   Private _Circle as MyCircle

   Public Property Circle() as MyCircle
       Get
           Circle = _Circle
       End Get
       Set(ByVal value As MyCircle)
           _Circle = value
           mylabel.Text = __Circle.Border.Width 'this doesn´t execute at all. WHY?
       End Set
   End Property
End Class

<TypeConverter(GetType(ExpandableObjectConverter))> _
Public Class MyCircle
   Private _Border As New MyBorder()

   <NotifyParentProperty(True), _
   RefreshProperties(RefreshProperties.All)> _  
   Public Property Border() As MyBorder
       Get
           Border = _Border
       End Get
       Set(ByVal value As MyBorder)
           _Border = value 'this line also doesn´t execute
       End Set
   End Property
End Class

<TypeConverter(GetType(ExpandableObjectConverter))> _
Public Class MyBorder
   Private _Width As Integer = 1
   Private _Color As Color = Color.Black

   <NotifyParentProperty(True), _
   RefreshProperties(RefreshProperties.All)> _
   Public Property Width() As Integer
       Get
           Return _Width
       End Get
       Set(ByVal value As Integer)
           _Width = value
       End Set
   End Property

   <NotifyParentProperty(True), _
   RefreshProperties(RefreshProperties.All)> _
   Public Property Color() as Color
       Get
            Return _Color
       End Get
       Set(ByVal value As Integer)
           _Color = value
       End Set
End Class

 

I want the control´s expandable properties to work properly - just like those in DevExpress Controls

Edited by bufer24

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