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

Add TabItem on Page_Load?

1 Answer 5 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 17 Oct 2013, 07:55 AM
Hi,

i use the RadTabControl like your DataBinding-Example. This works great, but how do i add a New Tab on Page_Load?
Second Problem, how to load the Content now and not after selecting the tab?

Thanks a lot
Best Regards
Rene

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 22 Oct 2013, 08:00 AM
Hello Rene,

Since you use data binding you need to update the ItemsSource collection of the RadTabControl in order to add item to the control. Please note that the collection must invoke the CollectionChanged event whenever it has been changed. By doing so your ViewModel will notify the UI that the ItemsSource of the control has been changed and the RadTabControl will add/remove the item. The best way to do this is to use ObservableCollection<T>. This native collection implements the event out of the box and it is suitable for data binding scenarios.

Regarding your second question - please note that the RadTabControl is designed to load the content of the selected item, only. In other words this is the designed and the expected behavior of the control. However, there may be a better approach in your particular scenario. And I could be able to help you on your way, but I will need you to elaborate more on your requirements. Could you please clarify what you have in mind when you say "now"? Do you mean the Loaded event of the page?

Thank you for your cooperation.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TabControl
Asked by
ITA
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or