Collection editor or subproperties

C

CaptnKebec

I created som custom controls with subproperties like...
Buttons --|-- Button1
|-- Button2

I would like to put subproperties in the subproperties like this;
Buttons --|--Button1--|--Visible
| |-- Disabled
|
|--Button2--|--Visible
|--Disbaled

Or have a collection with a collection editor to be able to put data in
those properties at design time.

I've tried to refer a class in my subclass but the embeded properties
doesn't show.
I've found couple of examples in C# but nothing in VB.

Here is the code for my control:
====================
Option Explicit On
Option Strict On

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel

Namespace SPCControls
Public Class ucTest
Inherits Control
Implements IPostBackEventHandler
Dim _WindowTitle As String
Dim _click As Integer

Event btClick(ByVal ButtonNo As String)

Public Sub RaisePostBackEvent(ByVal eventArgument As String)
Implements IPostBackEventHandler.RaisePostBackEvent
RaiseEvent btClick(eventArgument)
End Sub


Private Buttons As New SPCTypes.hdButtons
<DefaultValue(""), Category("Custom"), _
PersistenceMode(PersistenceMode.InnerProperty), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Property hdButtons() As SPCTypes.hdButtons
Get
Return Buttons
End Get
Set(ByVal Value As SPCTypes.hdButtons)
Buttons = Value
End Set
End Property


Property WindowTitle() As String
Get
Return _WindowTitle
End Get
Set(ByVal Value As String)
_WindowTitle = Value
End Set
End Property



Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
writer.Write(("<LINK REL=""stylesheet"" TYPE=""text/css""
HREF=""SPCStyles.css"">") & vbCr)

writer.Write(("<TABLE id=""Table1"" style=""PADDING-RIGHT: 0px;
PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; CLIP: rect(auto auto
auto auto); BORDER-TOP-STYLE: none; PADDING-TOP: 0px; BORDER-RIGHT-STYLE:
none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none""") & vbCr)
writer.Write((" height=""63"" cellSpacing=""0""
cellPadding=""0"" width=""100%"" align=""left"" border=""0"">") & vbCr)
writer.Write((" <TR>") & vbCr)
writer.Write((" <TD vAlign=""bottom"" align=""left""
width=""90%"" background=""./images/header/bar_top.png"">&nbsp; <IMG
onClick=""jscript:" & Page.GetPostBackEventReference(Me, "Back") & """
id=""IMG1""") & vbCr)
writer.Write((" class=""bt1_n""
onmouseover=""this.className='bt1_h'""
onmouseout=""this.className='bt1_n'""") & vbCr)

writer.Write((" src=""./images/bar_buttons/empty.gif"">&nbsp;") & vbCr)
writer.Write((" </TD>") & vbCr)
writer.Write((" <TD align=""right"" width=""90%""
background=""./images/header/bar_top.png""></TD>") & vbCr)
writer.Write((" <TD align=""right""><IMG alt=""""
src=""./images/header/bar_log.png""></TD>") & vbCr)
writer.Write((" </TR>") & vbCr)
writer.Write((" </TABLE>") & vbCr)

End Sub



End Class
End Namespace

******************************************
And here is the code for the class
======================
Imports System.ComponentModel
Namespace SPCTypes
<TypeConverter(GetType(ExpandableObjectConverter))> _
Public Class hdButtons
Private strButton1 As hdButton
Private strButton2 As hdButton

<DefaultValue(""), NotifyParentProperty(True),
RefreshProperties(RefreshProperties.Repaint)> _
Property [Button1]() As hdButton
Get
Return strButton1
End Get
Set(ByVal Value As hdButton)
strButton1 = Value
End Set
End Property
<DefaultValue(""), NotifyParentProperty(True),
RefreshProperties(RefreshProperties.Repaint)> _
Property [Button2]() As hdButton
Get
Return strButton2
End Get
Set(ByVal Value As hdButton)
strButton2 = Value
End Set
End Property
End Class
<TypeConverter(GetType(ExpandableObjectConverter))> _
Public Class hdButton
Private strVisible As String = ""
Private strPicture As String = ""

<DefaultValue(""), NotifyParentProperty(True),
RefreshProperties(RefreshProperties.Repaint)> _
Property [Visible]() As String
Get
Return strVisible
End Get
Set(ByVal Value As String)
strVisible = Value
End Set
End Property
<DefaultValue(""), NotifyParentProperty(True),
RefreshProperties(RefreshProperties.Repaint)> _
Property [Picture]() As String
Get
Return strPicture
End Get
Set(ByVal Value As String)
strPicture = Value
End Set
End Property
End Class

End Namespace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top