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

3 level Hierarchy gridview

1 Answer 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
igal a
Top achievements
Rank 1
igal a asked on 09 Nov 2009, 10:18 AM
i heard that you can do it with ChildTableDefinition

can someone show me how to do it?

i currently have 2 levels (parent->child)
i want to have 3 levels (parent->child->child of child)

how can i do it?

this is the xaml:

<Window x:Class="SimaClient.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    Title="Sima Client" Height="300" Width="400" WindowStyle="ToolWindow">  
    <Grid> 
        <telerik:RadGridView Name="RadGridView1" ShowGroupPanel="False" IsReadOnly="True" AutoGenerateColumns="False" ColumnsWidthMode="Fill">  
 
            <telerik:RadGridView.ChildTableDefinitions> 
                <telerik:GridViewTableDefinition /> 
            </telerik:RadGridView.ChildTableDefinitions> 
 
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="ID" Width="100" /> 
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"  Width="200"/>  
            </telerik:RadGridView.Columns> 
 
            <telerik:RadGridView.HierarchyChildTemplate> 
                <DataTemplate> 
                    <telerik:RadGridView x:Name="RadGridView1" AutoGenerateColumns="False" ItemsSource="{Binding Routes}" ShowGroupPanel="False" IsReadOnly="True">  
                        <telerik:RadGridView.Columns> 
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="Route ID" /> 
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Route Name" /> 
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding WayPointsNum , Mode=OneWay }" Header="Number of WP" /> 
                        </telerik:RadGridView.Columns> 
                    </telerik:RadGridView> 
                </DataTemplate> 
            </telerik:RadGridView.HierarchyChildTemplate> 
 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Nov 2009, 07:33 AM
Hi,

You can check this blog post for more info:
http://blogs.telerik.com/vladimirenchev/posts/09-10-16/how_to_silverlight_grid_hierarchy_load_on_demand_using_mvvm_and_ria_services.aspx

The post is for Silverlight however the approach and the grid XAML is exactly the same in WPF since our code is completely shared between both platforms.

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
igal a
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or