TabContent

8 posts, 0 answers
  1. Alex
    Alex avatar
    3 posts
    Member since:
    Jun 2011

    Posted 23 Jun 2011 Link to this post

    Is any samples or links  to see how make, Rad:tabitem Content,  is it possible to load  SilverlightUserControl.xaml  as Content
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Jun 2011 Link to this post

    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
  3. DevCraft banner
  4. Charlie
    Charlie avatar
    5 posts
    Member since:
    Jun 2011

    Posted 07 Jul 2011 Link to this post

    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!
  5. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 08 Jul 2011 Link to this post

    TabControl.Items.Add(new RadTabItem()
    {
        Header = "Tab Item 1",
        Content = new TabPage(),
    });
     
    TabControl.Items.Add(new RadTabItem()
    {
        Header = "Tab Item 2",
        Content = new TabPage(),
    });
  6. Charlie
    Charlie avatar
    5 posts
    Member since:
    Jun 2011

    Posted 08 Jul 2011 Link to this post

    Oh duh!

    Thanks a bunch! I should have been able to pick up on that. Still pretty new to this stuff :)
  7. Charlie
    Charlie avatar
    5 posts
    Member since:
    Jun 2011

    Posted 08 Jul 2011 Link to this post

    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!

  8. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 11 Jul 2011 Link to this post

    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
  9. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 13 Jul 2011 Link to this post

    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!

Back to Top
DevCraft banner