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:
I want the control´s expandable properties to work properly - just like those in DevExpress Controls
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:
Code:
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
Attachments
Last edited: