This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to write an application where the main view has a RibbonBar and a TabControl below it. What I need to accomplish is to add Tabs to the TabControl, in response to the user click on buttons in the RibbonBar, and also allow closing of open tabs, both without disturbing the other tabs that are open.
Each tab that I need to open contain different UserControl controls.
I did this by doing the following:
public void buttonX_Clicked(....)
{
RadTabItem newTab = new RadTabItem() { Header = "The Text", Content = new PageX() } ;
tabCtrl.Items.Add(newTab);
tabCtrl.SelectedItem = newTab;
}
public void buttonY_Clicked(....)
{
RadTabItem newTab = new RadTabItem() { Header = "The Y Text", Content = new PageY() } ;
tabCtrl.Items.Add(newTab);
tabCtrl.SelectedItem = newTab;
}
I don't know if this the best way or not, but it worked.
What I did next was to look at the example How to Add Close Button to the Tab Header http://www.telerik.com/help/wpf/radtabcontrol-how-to-add-close-button-to-the-tab-headers.html
This uses Item templates for the header and content.
So I setup a new class for my tab items:
class MyTabItem
{
public string Title { get; set;}
public UserControl Content { get; set; }
}
And use a List<MyTabItem> and set the ItemsSource of the TabControl to the list.
What I can't figure out is, in the Item Template of the tab control, how do I bind the TabItem's Content property to the Content property in my MyTabItem.
Does anyone have any suggestions?
Thank you,
Ali
I'm trying to write an application where the main view has a RibbonBar and a TabControl below it. What I need to accomplish is to add Tabs to the TabControl, in response to the user click on buttons in the RibbonBar, and also allow closing of open tabs, both without disturbing the other tabs that are open.
Each tab that I need to open contain different UserControl controls.
I did this by doing the following:
public void buttonX_Clicked(....)
{
RadTabItem newTab = new RadTabItem() { Header = "The Text", Content = new PageX() } ;
tabCtrl.Items.Add(newTab);
tabCtrl.SelectedItem = newTab;
}
public void buttonY_Clicked(....)
{
RadTabItem newTab = new RadTabItem() { Header = "The Y Text", Content = new PageY() } ;
tabCtrl.Items.Add(newTab);
tabCtrl.SelectedItem = newTab;
}
I don't know if this the best way or not, but it worked.
What I did next was to look at the example How to Add Close Button to the Tab Header http://www.telerik.com/help/wpf/radtabcontrol-how-to-add-close-button-to-the-tab-headers.html
This uses Item templates for the header and content.
So I setup a new class for my tab items:
class MyTabItem
{
public string Title { get; set;}
public UserControl Content { get; set; }
}
And use a List<MyTabItem> and set the ItemsSource of the TabControl to the list.
What I can't figure out is, in the Item Template of the tab control, how do I bind the TabItem's Content property to the Content property in my MyTabItem.
Does anyone have any suggestions?
Thank you,
Ali