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

Multiple constructor call when change selected tab item & use style selector...

5 Answers 45 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Tomas
Top achievements
Rank 1
Tomas asked on 26 Jan 2012, 08:33 PM
Hallo,
we have a new issue with RadTabControl - when we use style selector to use RadTabControl in MVVM concept, after we create more than one TabItems, after each active tab control item change, the View's constructor is everytime called.. - why RadTabControl is creating everytime new instance??? (-> Click on the button to add any tab items, create breakpoint into constructor UserControl1() and switch between the tabs...)
When we change RadTabControl into TabControl (remove all Telerik's stuff from MainWindow.xaml), the problem is solved... Thank you for your help...

5 Answers, 1 is accepted

Sort by
0
Tomas
Top achievements
Rank 1
answered on 26 Jan 2012, 08:37 PM
Sorry - is it possible to upload .zip sample there??? There is a limit for pictures only...? I can't upload a zip sample :-(
0
Petar Mladenov
Telerik team
answered on 31 Jan 2012, 09:22 AM
Hi Tomas ,

 In order to keep the TabItem's content in memory (and this way not re-initializing) you can set the IsContentPreserved to True. Please check out this help article for more info on this.
On a side note, you will be able to attach zips if you open a support thread.

Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Joel
Top achievements
Rank 1
answered on 12 Dec 2013, 12:28 PM
I wonder should this be a default behavior because i almost give up on using RadTabControl...
0
Pavel R. Pavlov
Telerik team
answered on 16 Dec 2013, 04:31 PM
Hello Joel,

Please note that there is a designer's decision behind the default value of each property in our controls. Could you please share with us the reasons why setting a property in your application is an obstacle. Also, please note that this particular property is well described in our documentation.

Thank you for your feedback.

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 >>
0
Joel
Top achievements
Rank 1
answered on 17 Dec 2013, 01:23 AM
The blame was not obvious in the first place to point to this default behavior.
I look at my other codes before decided to dig through the documentation and Google to find out the source of the multiple constructor call.... well finally landed at this posting to confirm the blame.
Tags
TabControl
Asked by
Tomas
Top achievements
Rank 1
Answers by
Tomas
Top achievements
Rank 1
Petar Mladenov
Telerik team
Joel
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or