Vote count:
0
After breaking down all possible causes of the issue, I have arrived with the following situation. I have a custom user control containing a panel and a control (button, label etc...) within this panel. I have also created public read only properties for the panel as well as the child control of the panel. Each of these properties has their DesignerSerializationVisibility attribute set to Content. When configured this way no code is serialized for the child control of the panel when the custom user control is used on a form. Upon building the control, the child control either disappears or experiences an incomplete rendering at design-time. If I change either the panel or its child control’s DesignerSerializationVisibility to visible, everything serializes and renders correctly. However, this then prevents me from being able to provide the end user with the ability to adjust either the panel or child controls property values. I have provided the code below as well as a picture of what is occurring. This one truly has me stumped!
Public Class ExampleUserControl
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
<Browsable(True), _
EditorBrowsable(EditorBrowsableState.Always), _
Category("Appearance"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property LeftPanel As Panel
Get
Return Me.ExampleLeftPanel
End Get
End Property
<Browsable(True), _
EditorBrowsable(EditorBrowsableState.Always), _
Category("Control"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property LeftPanelButton As Button
Get
Return Me.ExampleLeftButton
End Get
End Property
<Browsable(True), _
EditorBrowsable(EditorBrowsableState.Always), _
Category("Appearance"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property RightPanel As Panel
Get
Return Me.ExampleRightPanel
End Get
End Property
<Browsable(True), _
EditorBrowsable(EditorBrowsableState.Always), _
Category("Control"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property RightPanelButton As Button
Get
Return Me.ExampleRightButton
End Get
End Property
End Class
Aucun commentaire:
Enregistrer un commentaire