Adding UserControl to RadTabControl and making added control fill available space

3 posts, 0 answers
  1. Peter
    Peter avatar
    13 posts
    Member since:
    May 2012

    Posted 09 May 2012 Link to this post

    I am adding UserControls to a RadTabControl at runtime thus:

                var tabItem = new RadTabItem();
                tabItem.Header = somestring
                tabItem.Content = new RtiDetailViewer();
                ImagesTabControl.Items.Add(tabItem);

    Where RtiDetailViewer is a UserControl.

    However, I have been unable to find a way to ensure that the added UserControl fills the available space, any help would be appreciated.
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 May 2012 Link to this post

    Hello Peter,

    First, we highly recommend you to build your UI in XAML and not in code behind, this way you can save hundreds of lines of code.
    What is the Template of your custom control ? Is it possible to set HorizontalAlignment and VerticalAlignment to Stretch on your control or on the containers from its Template ? 

    Greetings,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Peter
    Peter avatar
    13 posts
    Member since:
    May 2012

    Posted 14 May 2012 Link to this post

    Thanks for that, the user control is built in XAML but is loaded into the RadTabControl at run time based on user record/data selection.
    But this works!!
Back to Top