WPF Hirarchial Gridview

2 posts, 0 answers
  1. V
    V avatar
    1 posts
    Member since:
    May 2015

    Posted 12 May 2015 Link to this post

    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

     

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 14 May 2015 Link to this post

    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
Back to Top