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

WPF Hirarchial Gridview

1 Answer 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
V
Top achievements
Rank 1
V asked on 12 May 2015, 06:29 AM

Hi,

We are trying to populate the parent / child data in hierarchical gridview at runtime. Columns of the grid view is based on the login user. So, we are not set the columns at design.

We use parent - child relationship as below code logic. We can see the parent details and child details. However, for child details, it is showing all information. It should be shown the data which is associated with the parent data.

  <commonData:ExtendedGridView x:Name="HierarchicalGridView1"  
                                             Grid.Column="0" Margin="55,27,0,10" Grid.ColumnSpan="2"
                                             CanUserReorderColumns="False" AutoGenerateColumns="False"   
                                             ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"       
                                             ItemsSource="{Binding Source={StaticResource CollectionVM},Path=ParentCollection}"
                                             commonData:GridViewBindingBehavior.ColumnsCollection="{Binding Source={StaticResource CollectionVM},Path=DynParentColumns}"
                                             >
                            <telerik:RadGridView.ChildTableDefinitions >
                                <telerik:GridViewTableDefinition  >

                                    <telerik:GridViewTableDefinition.Relation>
                                        <telerik:TableRelation IsSelfReference="False">
                                            <telerik:TableRelation.FieldNames>
                                                <telerik:FieldDescriptorNamePair
                     ParentFieldDescriptorName="ORDNO"
                     ChildFieldDescriptorName="ORDNO" />
                                            </telerik:TableRelation.FieldNames>
                                        </telerik:TableRelation>
                                    </telerik:GridViewTableDefinition.Relation>
                                </telerik:GridViewTableDefinition>
                            </telerik:RadGridView.ChildTableDefinitions>


                            <telerik:RadGridView.HierarchyChildTemplate >
                                <DataTemplate>
                                    <commonData:ExtendedGridView ShowColumnHeaders="False" ItemsSource="{Binding Source={StaticResource CollectionVM},Path=ChildCollection}" AutoGenerateColumns="False"  ShowGroupPanel="False"
                                                         commonData:GridViewBindingBehavior.ColumnsCollection="{Binding Source={StaticResource CollectionVM},Path=DynParentColumns}" >
                                    </commonData:ExtendedGridView>
                                </DataTemplate>
                            </telerik:RadGridView.HierarchyChildTemplate>

Your help is much appreciated.

Thanks

VG

 

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 14 May 2015, 01:08 PM
Hi VG,

In case the Relation you use does not serve the desired purpose, you can additionally specify HierarchyChildTemplate. I would also suggest you considering the Row Details option to define hierarchy data.

You can also refer to the WPF Demos


Regards,
Dimitrina
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
V
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or