7 Answers, 1 is accepted
0
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
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:
Would there be a way to add in those "local" references via C# code?
Thanks!
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 :)
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:
Thanks in advance!
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
http://www.telerik.com/community/forums/silverlight/tabcontrol/data-binding.aspx
0
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
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!