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

6 posts, 0 answers
  1. Tomas
    Tomas avatar
    21 posts
    Member since:
    Sep 2010

    Posted 26 Jan 2012 Link to this post

    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...
  2. Tomas
    Tomas avatar
    21 posts
    Member since:
    Sep 2010

    Posted 26 Jan 2012 Link to this post

    Sorry - is it possible to upload .zip sample there??? There is a limit for pictures only...? I can't upload a zip sample :-(
  3. UI for WPF is Visual Studio 2017 Ready
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 31 Jan 2012 Link to this post

    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 >>

  5. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 12 Dec 2013 Link to this post

    I wonder should this be a default behavior because i almost give up on using RadTabControl...
  6. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 16 Dec 2013 Link to this post

    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 >>
  7. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 16 Dec 2013 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready