display parent row info in child table

3 posts, 0 answers
  1. Dan
    Dan avatar
    22 posts
    Member since:
    Jun 2011

    Posted 11 Apr 2013 Link to this post

    if you setup hierarchy and you want bind / display info in the child grid for the parent row it belongs to..in the xaml/bing how can you get reference to parent row from the child as part of databinding...

    <telerik:RadGridView Name="gridView" ItemsSource="{Binding Person}">
        <telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition />
        </telerik:RadGridView.ChildTableDefinitions>
        <telerik:RadGridView.HierarchyChildTemplate>
            <DataTemplate>
                <StackPanel>
                <TextBlock Text="{Binding ParentRow.SomeProperty}"/>
                <telerik:RadGridView ItemsSource="{Binding Children}" Name="childGrid" ShowGroupPanel="False" />
                </StackPanel>
            </DataTemplate>
        </telerik:RadGridView.HierarchyChildTemplate>
    </telerik:RadGridView>
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 15 Apr 2013 Link to this post

    Hello,

    Please note that the DataContext for the hierarchy is the item bound to the parent row.
    You can display the parent row's info like so:

    <telerik:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
            <StackPanel>
            <TextBlock Text="{Binding SomeProperty}"/>
            <telerik:RadGridView ItemsSource="{Binding Children}" Name="childGrid" ShowGroupPanel="False" />
            </StackPanel>
        </DataTemplate>
    </telerik:RadGridView.HierarchyChildTemplate>


    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Dan
    Dan avatar
    22 posts
    Member since:
    Jun 2011

    Posted 15 Apr 2013 Link to this post

    Duh...not sure why I wasn't thinking that first...I'll chalk it up to a long day, lol
Back to Top