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

Collapse RowDetailstemplate

2 Answers 164 Views
GridView
This is a migrated thread and some comments may be shown as answers.
naresh
Top achievements
Rank 1
naresh asked on 09 Aug 2011, 03:08 PM
Hi,
I am facing one problem.I am using RowDetailstemplate to show nested data.....working fine..
But when I expand the some other row  it need Collapse previous expanded row.
I want show expanded row one at a time.

Is there any way to achieve the functionality.It is help full if you provide sample solution..............

Thanks and Regards
Naresh Mesineni

2 Answers, 1 is accepted

Sort by
0
Ray
Top achievements
Rank 1
answered on 06 Sep 2013, 09:18 PM
This will accomplish what you're trying to do:

            
//The logic in this if statement will close the previously open GridRowDetails selection
            if (e.Visibility == System.Windows.Visibility.Visible)
            {
                if (lastExpandedRow != null)
                {
                    lastExpandedRow.DetailsVisibility = System.Windows.Visibility.Collapsed;
                }
 
                lastExpandedRow = e.Row;
            }

0
Rossen Hristov
Telerik team
answered on 09 Sep 2013, 06:23 AM
Hi,

Yes, that is a perfect solution.

Another approach would be to use the GridViewToggleRowDetailsColumn which has a property called ExpandMode which does exactly what you want. Simply set it to Single and you will have only one row detail expanded at a time.

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
naresh
Top achievements
Rank 1
Answers by
Ray
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or