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

Make Child Grids Group Together

5 Answers 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Boots
Top achievements
Rank 1
Boots asked on 30 Aug 2010, 11:03 PM
Hello,

I'm not sure how to go about this. I'd like my child Grids to group together, by that i mean I would like it when one is gouped by a specified value i'd like each GridView bound to that DataTemplate to group as well. I'm just not sure where to get started.

below is an example of my RadGridView.

<telerik:RadGridView x:Name="rgv" AutoGenerateColumns="False" RccControls:GridViewHeaderContextMenu.IsEnabled="True" >
                        <telerik:RadGridView.ChildTableDefinitions>
                            <telerik:GridViewTableDefinition />
                        </telerik:RadGridView.ChildTableDefinitions>
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn Header="Value 1" DataMemberBinding="{Binding Path=Value1}" />
                            <telerik:GridViewDataColumn Header="Value 2" DataMemberBinding="{Binding Path=Value2}" />
                        </telerik:RadGridView.Columns>
                        <telerik:RadGridView.HierarchyChildTemplate>
                            <DataTemplate>
                                <telerik:RadGridView
                                    CanUserFreezeColumns="False"
                                    AutoGenerateColumns="False"
                                    ItemsSource="{Binding ChildItems}"
                                    IsReadOnly="True"
                                    RccControls:GridViewHeaderContextMenu.IsEnabled="True"
                                    Grouped="RadGridView_Grouped">
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding ChildValue1}" Header="Child Value 1" />
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding ChildValue2}" Header="Child Value 2" />
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </DataTemplate>
                        </telerik:RadGridView.HierarchyChildTemplate>
                    </telerik:RadGridView>

Any suggestions or a starting point would be great.

Thanks Again,
~Boots

5 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 31 Aug 2010, 12:50 PM
Hi Boots,

 Please find attached a sample solution.

Greetings,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Boots
Top achievements
Rank 1
answered on 31 Aug 2010, 03:59 PM
Hi Yavor,

Thanks for the simple solution. works great. I tried the same thing with SortDescriptors on the RadGridView but the e.Action always returns "Reset". Any suggestions on a starting point for sorting?

Thanks Again,
~Boots
0
Yavor Georgiev
Telerik team
answered on 31 Aug 2010, 05:13 PM
Hello Boots,

 Here is the updated project.

Sincerely yours,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Boots
Top achievements
Rank 1
answered on 31 Aug 2010, 07:17 PM
Hi Yavor,

Thanks again! That worked perfect. Another thing I'd like to add is Aggregates. I'm using the Header Context Menu example from the demo's and applying that to the child grid. I was wondering if you have any ideas on how i can accomplish the same as sorting or grouping but with aggregates instead?

Thanks Again,
~Boots
0
Yavor Georgiev
Telerik team
answered on 03 Sep 2010, 10:41 AM
Hello Boots,

 You can modify the Behavior I've used to expose static methods like AddAgregate(column, aggregate) and then modify your context menu implementation to access the Behavior and invoke those methods. You can get the behaviors for an object like so:

var behaviors = System.Windows.Interactivity.Interaction.GetBehaviors(radGridView1);

Sincerely yours,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Boots
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Boots
Top achievements
Rank 1
Share this question
or