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

TabContent

7 Answers 82 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 23 Jun 2011, 08:14 AM
Is any samples or links  to see how make, Rad:tabitem Content,  is it possible to load  SilverlightUserControl.xaml  as Content

7 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Jun 2011, 01:17 PM
Hello Alex,

I prepared a sample for you that shows how to use UserControls in the RadTabItem`s Content. Please examine it and let us know if it satisfies you.


Regards,
Petar Mladenov
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
0
Charlie
Top achievements
Rank 1
answered on 07 Jul 2011, 04:56 PM
Is there a way to programmatically add content to a RadTabItem as opposed to hard-coding it as it is done in the example?

So instead of:

<Grid x:Name="LayoutRoot" Background="LightGray">
        <telerik:RadTabControl x:Name="TabControl" telerik:StyleManager.Theme="Windows7">
            <telerik:RadTabItem Header="Tab 1">
                <local:TabPage></local:TabPage>
            </telerik:RadTabItem>
            <telerik:RadTabItem Header="Tab 2">
                <local:TabPage></local:TabPage>
            </telerik:RadTabItem>
        </telerik:RadTabControl>
</Grid>

Would there be a way to add in those "local" references via C# code?

Thanks!
0
hwsoderlund
Top achievements
Rank 1
answered on 08 Jul 2011, 10:12 AM
TabControl.Items.Add(new RadTabItem()
{
    Header = "Tab Item 1",
    Content = new TabPage(),
});
 
TabControl.Items.Add(new RadTabItem()
{
    Header = "Tab Item 2",
    Content = new TabPage(),
});
0
Charlie
Top achievements
Rank 1
answered on 08 Jul 2011, 02:11 PM
Oh duh!

Thanks a bunch! I should have been able to pick up on that. Still pretty new to this stuff :)
0
Charlie
Top achievements
Rank 1
answered on 08 Jul 2011, 08:42 PM
Here is a slightly more complicated question.

I have a WCF service that returns an ObservableCollection. I'm able to easily set the DisplayMemberPath of each tab to the "name" field I'm returning in the collection. However, I want to be able to set the Content of EACH tab item to be my other XAML page like above. How can I achieve this?

Here's the code I have so far:

private void PopulateTabs()
{
            mphealthcareClient client = new mphealthcareClient();
            client.GetTabsCompleted += new EventHandler<GetTabsCompletedEventArgs>(client_GetTabsDataCompleted);
            client.GetTabsAsync();
}
 
void client_GetTabsDataCompleted(object sender, GetTabsCompletedEventArgs e)
{
            TabControl.ItemsSource = e.Result;
            TabControl.DisplayMemberPath = "MPT_NAME";
            //Need to set each tab's content to TabPage
}


Thanks in advance!

0
hwsoderlund
Top achievements
Rank 1
answered on 11 Jul 2011, 10:58 AM
Check out this forum thread. It describes how to use ContentTemplate to set the content of the tab items. I think that should get you where you want.
http://www.telerik.com/community/forums/silverlight/tabcontrol/data-binding.aspx
0
Petar Mladenov
Telerik team
answered on 13 Jul 2011, 02:23 PM
Hello Hwsoderlund,

You can also check this help article for more info on ContentTemplates and ContentTemplateSelectors. Let us know if you need further assistance.

All the best,
Petar Mladenov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
TabControl
Asked by
Alex
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Charlie
Top achievements
Rank 1
hwsoderlund
Top achievements
Rank 1
Share this question
or