RadTabItem :setting dataContext before Loaded event

2 posts, 0 answers
  1. Marc-André
    Marc-André avatar
    3 posts
    Member since:
    Jan 2009

    Posted 25 Jul 2010 Link to this post


    I'm using a RadTabControl with a different usercontrol inside each tabs.  Each user control has it's own viewModel.  Now I'm trying to assign the datacontext of a usercontrol BEFORE the tab has been Loaded (the user did not visit this tab).  Here is the code I'm using:

    ucProjectLayoutV2 = new ProjectLayoutV2View();
    ucProjectLayoutV2.DataContext = new VM.ProjectLayoutViewModel();

    This works fine, except when the user navigates to the tabItem, it looks like my initialization is gone and a new usercontrol is created from scratch.  Am I misunderstanding something in the RadTabControl behavior?

    Is there a way maybe to PreLoad all tabItems? Or maybe there's a better way to handle this... Please help me out.


  2. Viktor Tsvetkov
    Viktor Tsvetkov avatar
    382 posts

    Posted 28 Jul 2010 Link to this post

    Hello Marc-André,

    You can try handling the PreviewSelectionChanged event of the RadTabControl, but if you want you can send us your sample project so I will be able to help you better.

    On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverlight applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx

    Best wishes,
    Viktor Tsvetkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top