Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:45:52+00:00 2026-05-31T06:45:52+00:00

I am creating a User Control where I have a property called Items. Items

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:45:53+00:00Added an answer on May 31, 2026 at 6:45 am

    The following should point you in the right direction. Feel free to comment if you need any further detail.

    <ToolboxData("<{0}:LibraryPanelBar runat=""server""> </{0}:LibraryPanelBar>")>
    Public Class LibraryPanelBar
        Inherits HierarchicalDataBoundControl
    
        Private _Items As New LibraryPanelBarItemCollection()
    
        <PersistenceMode(PersistenceMode.InnerProperty)> _
        <MergableProperty(False)> _
        <Editor("WebApplicationVB1.TreeNodeCollectionEditor,WebApplicationVB1", GetType(UITypeEditor))> _
        Public ReadOnly Property Items As LibraryPanelBarItemCollection
            Get
                Return _Items
            End Get
        End Property
    
        Protected Overrides Sub PerformSelect()
    
        End Sub
    
        Protected Overrides Sub ValidateDataSource(dataSource As Object)
    
        End Sub
    
        Protected Overrides Sub RenderContents(writer As System.Web.UI.HtmlTextWriter)
            writer.RenderBeginTag(HtmlTextWriterTag.Ul)
            For Each item As LibraryPanelBarItem In Items
                writer.RenderBeginTag(HtmlTextWriterTag.Li)
                RenderContentsRecursive(writer, item)
                writer.RenderEndTag() ' Li
            Next
            writer.RenderEndTag() ' Ul
        End Sub
        Private Sub RenderContentsRecursive(writer As System.Web.UI.HtmlTextWriter, item As LibraryPanelBarItem)
            writer.Write(item.Text)
            writer.WriteBreak()
            writer.RenderBeginTag(HtmlTextWriterTag.Ul)
            For Each subItem As LibraryPanelBarItem In item.Items
                writer.RenderBeginTag(HtmlTextWriterTag.Li)
                RenderContentsRecursive(writer, subItem)
                writer.RenderEndTag() ' Li
            Next
            writer.RenderEndTag() ' Ul
        End Sub
    End Class
    
    <ParseChildren(True, "Items")> _
    Public Class LibraryPanelBarItem
        Implements IStateManager, ICloneable
    
        Private _Items As New LibraryPanelBarItemCollection()
    
        <BindableAttribute(True)> _
        Public Property ImageUrl As String
    
        <BindableAttribute(True)> _
        Public Property NavigateUrl As String
        Public Property Text As String
        Public Property Disabled As Boolean
        <Browsable(False)> _
    <PersistenceMode(PersistenceMode.InnerDefaultProperty)> _
        Public ReadOnly Property Items As LibraryPanelBarItemCollection
            Get
                Return _Items
            End Get
        End Property
        Public ReadOnly Property HasChildren() As Boolean
            Get
                If Items.Count > 0 Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property
    
        Public ReadOnly Property IsTrackingViewState As Boolean Implements System.Web.UI.IStateManager.IsTrackingViewState
            Get
                Throw New NotImplementedException()
            End Get
        End Property
    
        Public Sub LoadViewState(state As Object) Implements System.Web.UI.IStateManager.LoadViewState
            Throw New NotImplementedException()
        End Sub
    
        Public Function SaveViewState() As Object Implements System.Web.UI.IStateManager.SaveViewState
            Throw New NotImplementedException()
        End Function
    
        Public Sub TrackViewState() Implements System.Web.UI.IStateManager.TrackViewState
            Throw New NotImplementedException()
        End Sub
    
        Public Function Clone() As Object Implements System.ICloneable.Clone
            Throw New NotImplementedException()
        End Function
    End Class
    
    Public Class LibraryPanelBarItemCollection
        Inherits CollectionBase
        Implements IStateManager
    
        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 ReadOnly Property IsTrackingViewState As Boolean Implements System.Web.UI.IStateManager.IsTrackingViewState
            Get
                Throw New NotImplementedException()
            End Get
        End Property
    
        Public Sub LoadViewState(state As Object) Implements System.Web.UI.IStateManager.LoadViewState
            Throw New NotImplementedException()
        End Sub
    
        Public Function SaveViewState() As Object Implements System.Web.UI.IStateManager.SaveViewState
            Throw New NotImplementedException()
        End Function
    
        Public Sub TrackViewState() Implements System.Web.UI.IStateManager.TrackViewState
            Throw New NotImplementedException()
        End Sub
    End Class
    
    Public Class LibraryPanelBarItemCollectionEditor
        Inherits System.Drawing.Design.UITypeEditor
    
        Public Overrides Function EditValue(context As System.ComponentModel.ITypeDescriptorContext, provider As System.IServiceProvider, value As Object) As Object
            Return MyBase.EditValue(context, provider, value)
        End Function
    
        Public Overrides Function GetEditStyle(context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
            Return MyBase.GetEditStyle(context)
        End Function
    
    End Class
    

    EDIT: Added UI collection editor example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom user control (ascx) that contains a textbox and a Javascript-based
I have a user control that I'm creating that is using some AJAX in
I am creating a user control where in i have different HTML text boxes
I am creating a custom user control and I am wondering how do you
I am creating Ribbon Control for my application and for which I have already
When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations
I am creating a user control in C# and I am adding my own
Given that you're creating a User Control in WPF that will be displayed on
Greetings! I'm creating a User Control that will display data in a GridView control.
I'm creating a control and need to pass it the current logon user as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.