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

RadTabItem :setting dataContext before Loaded event

1 Answer 71 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Marc-André
Top achievements
Rank 1
Marc-André asked on 26 Jul 2010, 02:54 AM
Hi,

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.

Thanks

Marc

1 Answer, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 28 Jul 2010, 09:20 AM
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
Tags
TabControl
Asked by
Marc-André
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Share this question
or