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

Force Visual Tree creation for tabs

3 Answers 167 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 24 Jan 2013, 01:10 PM
I want all my RadTabItem views to be built immediately. Currently, the visual tree is built when the tab is selected:

<telerik:RadTabControl
                       IsContentPreserved="True"
                       IsSynchronizedWithCurrentItem="True"

                       SelectedIndex="{Binding CurrentTabIndex}"
                       DropDownDisplayMode="Visible" IsTabStop="True">
  <telerik:RadTabItem Header="A" IsSelected="True">
    <views:MyView1 />
  </telerik:RadTabItem>
  <telerik:RadTabItem Header="B">
    <views:MyView2 />
  </telerik:RadTabItem>
  <telerik:RadTabItem Header="C">
    <views:MyView3 />
  </telerik:RadTabItem>
</telerik:RadTabControl>

I want all tabs, "A", "B" and "C", to be created immediately. (This is essential for one very complex problem that I'm trying to solve here.)

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 29 Jan 2013, 07:25 AM
Hi Kristoffer,

Our TabControl is design to postpone visual elements creation. You could preserve already created items but you could not force their explicit creation.
The only way to do it is to select each and every tab before proceeding with the rest of your application.

Hope this helps. Please let us know if you need more info or the provided approach does not work for you.

All the best,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kristoffer
Top achievements
Rank 1
answered on 29 Jan 2013, 08:05 AM
Ok. Would looping through the tabs and sequentially select them do the trick? E.g. in the main view's constructor? Or in the Loaded event?
0
Hristo
Telerik team
answered on 31 Jan 2013, 04:20 PM
Hi Kristoffer,

I would suggest using a dispatcher in the Loaded event. This should validate that the tab control is initialized.

Hope this helps. Please let us know if you need more info.

Regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TabControl
Asked by
Kristoffer
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Kristoffer
Top achievements
Rank 1
Share this question
or