I am creating a User Control where I have a property called Items. Items is of type LibraryPanelBarItemCollection (custom class) which contains a collection of LibraryPanelBarItem objects. I would like to be able to add these at design time by using the Collection editor that VS uses for adding things such as treenodes/listviewitems. Ideally I would also be able to declaratively add them to the html syntax. I can get the Items property to show up but I get no intellisense to add the items between the opening and closing tags.
In my user control I have the following property declared with the attributes
<ParseChildren(True, "Items")> _
Public Class LibraryPanelBar
Inherits System.Web.UI.UserControl
<PersistenceMode(PersistenceMode.InnerDefaultProperty)> _
<Browsable(True)> _
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Property Items As LibraryPanelBarItemCollection
...Do Some Stuff...
End Class
Here are my custom classes for the LibraryPanelBarItem and LibraryPanelBarItemCollection
Public Class LibraryPanelBarItem
<BindableAttribute(True)> _
Public Property ImageUrl As String
<BindableAttribute(True)> _
Public Property NavigateUrl As String
Public Property Text As String
Public Property Disabled As Boolean
Public Property ID As String
<PersistenceMode(PersistenceMode.InnerDefaultProperty)> _
Public Property Items As LibraryPanelBarItemCollection
Public ReadOnly Property HasChildren() As Boolean
Get
If Items.Count > 0 Then
Return True
Else
Return False
End If
End Get
End Property
Public Sub New()
Items = New LibraryPanelBarItemCollection
End Sub
End Class
Public Class LibraryPanelBarItemCollection
Inherits CollectionBase
Default Public ReadOnly Property Item(Index As Integer) As LibraryPanelBarItem
Get
Return DirectCast(List(Index), LibraryPanelBarItem)
End Get
End Property
Public Function Contains(itemType As LibraryPanelBarItem) As Boolean
Return List.Contains(itemType)
End Function
Public Function Add(itemType As LibraryPanelBarItem) As Integer
Return List.Add(itemType)
End Function
Public Sub Remove(itemType As LibraryPanelBarItem)
List.Remove(itemType)
End Sub
Public Sub Insert(index As Integer, itemType As LibraryPanelBarItem)
List.Insert(index, itemType)
End Sub
Public Function IndexOf(itemType As LibraryPanelBarItem) As Integer
Return List.IndexOf(itemType)
End Function
Public Sub New()
End Sub
End Class
Here is my current declaration in the aspx file:
<uc1:LibraryPanelBar ID="LibraryPanelBar2" runat="server">
<Items>
</Items>
</uc1:LibraryPanelBar>
The following should point you in the right direction. Feel free to comment if you need any further detail.
EDIT: Added UI collection editor example.