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

[Solved] NestedHierarchyChildTemplates in Q3 release doesn't work

2 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Juan Esteban Giraldo Gómez
Top achievements
Rank 1
Juan Esteban Giraldo Gómez asked on 25 Nov 2009, 08:06 AM

Hi, how are you?

I've tested a sample project titled TicketID_234244_NestedHierarchyChildTemplates sent by you in a post. This project works perfectly by using Q2 binaries files. When I move to the Q3 release, I found that the sample project doesn't work. Could you review this project and give an example to achieve this functionality with the new release.

I appreciate your help...


Thanks a lot...

Juan E. Giraldo 

Juan E. Giraldo 

2 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 30 Nov 2009, 01:24 PM
Hi Juan Esteban Giraldo Gómez,

Please, find the modified sample project. Here are the important changes:

using System.Windows.Controls;
using System.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using System;
using System.Globalization;
 
namespace TicketID_234244_NestedHierarchyChildTemplates
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
             
            // No need for code behind here!
             
            this.clubsGrid.ItemsSource = Club.GetClubs();
        }
    }
}

And the XAML:

<UserControl x:Class="TicketID_234244_NestedHierarchyChildTemplates.MainPage"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    <Grid>
        <telerik:RadGridView Name="clubsGrid"
                             AutoGenerateColumns="False"
                             ColumnsWidthMode="Auto">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn
                    Header="Name"
                    DataMemberBinding="{Binding Name}"/>
                <telerik:GridViewDataColumn
                    Header="Est."
                    DataMemberBinding="{Binding Established}"
                    DataFormatString="{}{0:yyyy}"/>
                <telerik:GridViewDataColumn
                    Header="Stadium"
                    DataMemberBinding="{Binding StadiumCapacity}"
                    DataFormatString="{}{0:N0}"/>
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.ChildTableDefinitions>
              <telerik:GridViewTableDefinition/>
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView
                        Name="playersGrid"
                        ItemsSource="{Binding Players}"
                        ShowGroupPanel="False"
                        AutoGenerateColumns="False"
                        ColumnsWidthMode="Auto">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn
                                Header="Name"
                                DataMemberBinding="{Binding Name}"/>
                            <telerik:GridViewDataColumn
                                Header="Number"
                                DataMemberBinding="{Binding Number}"/>
                            <telerik:GridViewDataColumn
                                Header="Position"
                                DataMemberBinding="{Binding Position}"/>
                            <telerik:GridViewDataColumn
                                Header="Country"
                                DataMemberBinding="{Binding Country}"/>
                        </telerik:RadGridView.Columns>
                      <telerik:RadGridView.ChildTableDefinitions>
                        <telerik:GridViewTableDefinition/>
                      </telerik:RadGridView.ChildTableDefinitions>
                      <telerik:RadGridView.HierarchyChildTemplate>
                            <DataTemplate>
                                <telerik:RadGridView
                                    Name="gamesGrid"
                                    ItemsSource="{Binding Games}"
                                    ShowGroupPanel="False"
                                    ColumnsWidthMode="Auto">
                                </telerik:RadGridView>
                            </DataTemplate>
                        </telerik:RadGridView.HierarchyChildTemplate>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
        </telerik:RadGridView>
    </Grid>
</UserControl>

I hope this helps.

By the way, you could also use the Row Details feature to display hierarchical data.

Greetings,
Ross
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.
0
Juan Esteban Giraldo Gómez
Top achievements
Rank 1
answered on 01 Dec 2009, 05:43 AM
Thanks a lot Ross, I appreciate your help!!
Tags
GridView
Asked by
Juan Esteban Giraldo Gómez
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Juan Esteban Giraldo Gómez
Top achievements
Rank 1
Share this question
or