Hello lee,
Before providing a solution, i wanted to ask you if there isn't any way of switching to the new
RadPageView control, because as you might now, the
RadTabBar is obsolete and will be removed soon...
Now, if you want to do this, there are a few things you have to know about the RadTabBar, first, by default it just accepts RadItems, not controls, but if you want the TabBar to accept controls, you have to create a group, and set it's
EnableHostedControlMode to true, after this you can add the controls you want using the groups
ContentPanel.Controls property. If you want to read some more about the RadTabBar control you should take a look at the available documentation (
PanelBar Documentation).
I have created a full working example as follows:
using System.Windows.Forms;
using Telerik.WinControls.UI;
public partial class Form1 : Form
{
private RadPanelBar radPanelBar1 = new RadPanelBar();
public Form1()
{
InitializeComponent();
this.Load += new System.EventHandler(Form1_Load);
}
void Form1_Load(object sender, System.EventArgs e)
{
radPanelBar1.Dock = DockStyle.Fill;
this.Controls.Add(radPanelBar1);
var radGroupContacts =
new RadPanelBarGroupElement();
radGroupContacts.Caption = "Contacts";
var radGroupCalendar =
new RadPanelBarGroupElement();
radGroupCalendar.Caption = "Calendar";
radPanelBar1.GroupStyle = Telerik.WinControls.PanelBarStyles.ListBar;
var radGroupTree =
new RadPanelBarGroupElement();
radGroupTree.EnableHostControlMode = true;
var radTreeView1 = new RadTreeView();
var node1 = new RadTreeNode("Node1");
var node2 = new RadTreeNode("Node2");
var node3 = new RadTreeNode("Node3");
var node4 = new RadTreeNode("Node4");
radTreeView1.Nodes.Add(node1);
radTreeView1.Nodes.Add(node2);
node1.Nodes.Add(node3);
node2.Nodes.Add(node4);
radTreeView1.Dock = DockStyle.Fill;
radGroupTree.ContentPanel.Controls.Add(radTreeView1);
radGroupTree.Caption = "TreeView Example";
radPanelBar1.Items.AddRange(new Telerik.WinControls.RadItem[] { radGroupTree, radGroupCalendar, radGroupContacts });
}
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga