I am adding the RadPanelbarGroupElement in RadPanelbar control on Runtime and adding the populated Treeview control in each group. The RadPanelbar is in OutlookNav style and for each group, EnableHostControlMode is true.
Everything works fine but if I click any of the Groups 4 times, the whole application hangs.
Please suggest. See the code below:
private void PreapreNavigationControl(Feature feature)
{
if (feature.Groups.Count > 0)
{
foreach (Group group in feature.Groups)
{
//Adding the treeview
RadTreeView treeView = new RadTreeView();
RadPanelBarGroupElement groupElement = new RadPanelBarGroupElement();
radPanelBarNavigation.Items.AddRange(new Telerik.WinControls.RadItem[] {groupElement});
ConfigureGroupElement(groupElement, group.Name, out treeView);
//Adding the Root Node
RadTreeNode rootNode = createAndRegisterTreeNode(group.Name, string.Empty);
treeView.Nodes.Add(rootNode);
foreach (Task task in group.Tasks)
{
RadTreeNode taskNode = createAndRegisterTreeNode(task.Name, task.NavigationCommandName);
rootNode.Nodes.Add(taskNode);
}
}
}
}
private RadPanelBarGroupElement ConfigureGroupElement(RadPanelBarGroupElement groupElement, string groupElementName, out RadTreeView treeView)
{
//RadPanelBarGroupElement groupElement = new RadPanelBarGroupElement();
treeView = new RadTreeView();
//Designer Code
groupElement.ContentPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(treeView)).BeginInit();
groupElement.Caption = groupElementName;
// groupElement.ContentPanel
groupElement.ContentPanel.BackColor = System.Drawing.SystemColors.ControlLightLight;
groupElement.ContentPanel.CausesValidation = true;
groupElement.ContentPanel.Controls.Add(treeView);
groupElement.EnableHostControlMode = true;
groupElement.Text = groupElementName;
// treeView
treeView.BackColor = System.Drawing.Color.Transparent;
treeView.Dock = System.Windows.Forms.DockStyle.Fill;
treeView.Font = new System.Drawing.Font("Tahoma", 8.6F);
treeView.Location = new System.Drawing.Point(0, 0);
treeView.ShowItemToolTips = true;
treeView.ShowLines = true;
treeView.ShowRootLines = true;
treeView.ThemeClassName = "Telerik.WinControls.UI.RadTreeView";
treeView.Size = new System.Drawing.Size(277, 416);
groupElement.ContentPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(treeView)).EndInit();
return groupElement;
}