3 Answers, 1 is accepted
0
Hi David,
Yes, you can add a TabItems programmatically like so:
Of course it is always better to use business objects and bindings. To do so:
1. Set the ItemsSource property to an (observable) collection of your items
2. Provide style or DataTemplate bindings for the control (in xaml).
For example style bindings can be specified this way:
For the above code you need an object that has Description and Content properties.
All the best,
Miroslav
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Yes, you can add a TabItems programmatically like so:
tabControl.Items.Add(new RadTabItem() |
{ |
Header = "My Header", |
Content = "My Content" |
}); |
Of course it is always better to use business objects and bindings. To do so:
1. Set the ItemsSource property to an (observable) collection of your items
2. Provide style or DataTemplate bindings for the control (in xaml).
For example style bindings can be specified this way:
<nav:RadTabControl x:Name="tabControl"> |
<nav:RadTabControl.ItemContainerStyle> |
<Style TargetType="nav:RadTabItem"> |
<Setter Property="Header" |
Value="{Binding Description}" /> |
<Setter Property="Conent" |
Value="{Binding Content}" /> |
</Style> |
</nav:RadTabControl.ItemContainerStyle> |
</nav:RadTabControl> |
For the above code you need an object that has Description and Content properties.
All the best,
Miroslav
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

dbernett
Top achievements
Rank 2
answered on 17 Oct 2012, 04:59 PM
Brand new to WPF. I have a main window with your Ribbon Tab at top with buttons to open different windows.
Could you please tell me the technique to open windows
inside a Rad Tab Control below the Ribbon Tab.
I need to dynamically build out the tabs as different windows are
opened, and to close the tabs.
Thanks so much!
0
Hello David,
If I get you right, you need something like this example. If you need to check the example in WPF you can run our demos from here and navigate to RadTabControl's DataBinding example. The only thing you might need to change is to move the button that adds a new RadTabItem from RadTabItem's header in the RadRibbonTabs.
If you need further assistance don't hesitate to contact us.
Regards,
Stefan
the Telerik team
If I get you right, you need something like this example. If you need to check the example in WPF you can run our demos from here and navigate to RadTabControl's DataBinding example. The only thing you might need to change is to move the button that adds a new RadTabItem from RadTabItem's header in the RadRibbonTabs.
If you need further assistance don't hesitate to contact us.
Regards,
Stefan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.