new radgridview from code behind

2 posts, 0 answers
  1. Anthony
    Anthony avatar
    13 posts
    Member since:
    Aug 2014

    Posted 28 Aug 2014 Link to this post

    is it possible to add a radgridview control to a tabcontrol/tabitem programmatically? i need to dynamically create tabs and then populate them with a grid that has a radgridview, radchart, etc.

    i can't figure out how to do this, so i'm starting to think it isn't possible. if that's the case, is there a way to somehow template the tabs in xaml so i can simply instantiate them in code behind and the structure is already built?
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 28 Aug 2014 Link to this post


    Everything you can do in XAML, you can also implement in code.
    You can create RadGridView in code similar to:
    RadGridView grid = new RadGridView();
    grid.ItemsSource = model.Clubs;
    // Columns will be auto generated foreach property of the bound business objects (of type Club)
    // You can also add other columns through grid.Columns collection
    GridViewDataColumn column = new GridViewDataColumn();
    // Configure other settings
    grid.Name = "clubsGrid1";

    // Add RadGridView to the Grid defined in Xaml

    // Set the proper RowDefinition if needed
    Grid.SetRow(grid, 2);

    LayoutRoot is an instance of WPF Grid.
    <Grid x:Name="LayoutRoot">...</Grid>

    You can also check the How to create a Grid in WPF Dynamically blog post.

    As to your question on TabItems, I would suggest you to post them in the respective forums.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top