Force Visual Tree creation for tabs

4 posts, 0 answers
  1. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 24 Jan 2013 Link to this post

    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.)
  2. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 29 Jan 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 29 Jan 2013 Link to this post

    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?
  5. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 31 Jan 2013 Link to this post

    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.

Back to Top