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

Problem with AutoExpandGroups

1 Answer 103 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.
Robert
Top achievements
Rank 1
Robert asked on 21 Sep 2011, 05:19 PM
I`m trying to use a nested grid view and have all child rows be auto expanded, I thought the AutoExpandGroups property could be used but this doesn't seem to work.
Code;

<telerik:RadGridView Grid.Column="1" x:Name="MoversGrid" ShowGroupPanel="False"  
                                 ItemsSource="{Binding MoversReports}" telerik:StyleManager.Theme="Windows7"
                                 RowIndicatorVisibility="Collapsed"
                                 ScrollViewer.VerticalScrollBarVisibility="Auto"
                                 IsFilteringAllowed="False"
                                 AutoGenerateColumns="False" 
                                 VerticalAlignment="top" 
                                 CanUserFreezeColumns="False"
                                 VerticalContentAlignment="Top"
                                 ShowColumnHeaders="False"
                                 AutoExpandGroups="True"
                                 ColumnWidth="*">    
                        <telerik:RadGridView.Columns>                            
                            <telerik:GridViewDataColumn Background="White" TextWrapping="Wrap" DataMemberBinding="{Binding Description, Mode=TwoWay}">
                                <telerik:GridViewDataColumn.CellEditTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Description, Mode=TwoWay}" TextWrapping="Wrap" Background="White" IsEnabled="False" />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellEditTemplate>
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>


                        <telerik:RadGridView.ChildTableDefinitions>
                            <telerik:GridViewTableDefinition>


                            </telerik:GridViewTableDefinition>
                        </telerik:RadGridView.ChildTableDefinitions>


                        <telerik:RadGridView.HierarchyChildTemplate>
                            <DataTemplate>
                                <telerik:RadGridView
                                ItemsSource="{Binding ActivityHeaders}"
                                x:Name="docTypes"
                                ShowGroupPanel="False"
                                AutoGenerateColumns="False"  
                                RowIndicatorVisibility="Collapsed"    
                                ShowColumnHeaders="False" AutoExpandGroups="True" ColumnWidth="*">
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn Background="White" Width="50" />
                                        <telerik:GridViewDataColumn TextWrapping="Wrap" Background="LimeGreen" DataMemberBinding="{Binding Description, Mode=TwoWay}">
                                            <telerik:GridViewDataColumn.CellEditTemplate>
                                                <DataTemplate>
                                                    <TextBox Text="{Binding Description, Mode=TwoWay}" TextWrapping="Wrap" Background="LimeGreen" IsEnabled="False" />
                                                </DataTemplate>
                                            </telerik:GridViewDataColumn.CellEditTemplate>
                                        </telerik:GridViewDataColumn>
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </DataTemplate>
                        </telerik:RadGridView.HierarchyChildTemplate>
                        
                    </telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 22 Sep 2011, 07:00 AM
Hello Robert,

Actually, AutoExpandGroups property being set to "True" will expand all groups, not the hierarchical items. If you want to expand all child grids, you may call ExpandAllHierarchicalItems() method of RadGridView during its DataLoaded event for example:

private void clubsGrid_DataLoaded(object sender, EventArgs e)
        {
            (sender as RadGridView).ExpandAllHierarchyItems();
        }

I am sending you a sample project illustrating the suggested approach.

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Robert
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or