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

Adding UserControl to RadTabControl and making added control fill available space

2 Answers 90 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 09 May 2012, 04:06 PM
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 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 14 May 2012, 06:59 AM
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 >>

0
Peter
Top achievements
Rank 1
answered on 14 May 2012, 09:00 AM
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!!
Tags
TabControl
Asked by
Peter
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or