This is a migrated thread and some comments may be shown as answers.

Add LayoutControlGroupItem by Code

1 Answer 154 Views
LayoutControl
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 05 May 2016, 12:33 PM

Hi to all,

I would create a structure like this:

  • MainForm (mdi)
  • PageView (outlook) dock.left
  • LayoutControlTabbedGroup
  • Every PageView contains a treeview (classic outlook approach)
  • When click a node of current pageview-treeview, it has to:
    • Create a LayoutControlGroupItem
    • Create a MyUserControl (relative to type of node)
    • Add MyUserControl to LayoutControlGroupItem
    • Add LayoutControlGroupItem to LayoutControlTabbedGroup

    Can I do this?

    Actually Imet this problem, when I try to add valuteUC to valuteLG it says me thatvaluteLG.Container = Nothing

    What I have to do?

    Dim valuteUC = New ValuteUserControl()
    Dim valuteLG = New LayoutControlGroupItem()
    valuteLG.Container.Add(valuteUC)
    MainLayoutControlTabbedGroup.Container.Add(valuteLG)

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 06 May 2016, 10:35 AM
Hi Potito,

Thank you for writing.

The following snippet shows how you can add items to RadLayoutControl:
radLayoutControl1.SuspendLayout()
 
Dim tabbedgroup As New LayoutControlTabbedGroup()
 
Dim groupItem As New LayoutControlGroupItem()
groupItem.Text = "group 1"
tabbedgroup.ItemGroups.Add(groupItem)
 
radLayoutControl1.AddItem(tabbedgroup)
 
Dim button As New RadButton() With {.Text = "Button"}
button.Click += Button_Click
Dim item As New LayoutControlItem()
item.AssociatedControl = button
 
radLayoutControl1.AddItem(item, groupItem.ContainerElement)
 
radLayoutControl1.ResumeLayout()

The above code uses the AddItem method which provides several overrides and it is recommended for the items adding.

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
LayoutControl
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Dimitar
Telerik team
Share this question
or