Collapse RowDetailstemplate

3 posts, 0 answers
  1. naresh
    naresh avatar
    23 posts
    Member since:
    Jul 2012

    Posted 09 Aug 2011 Link to this post

    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. Ray
    Ray avatar
    10 posts
    Member since:
    May 2013

    Posted 06 Sep 2013 Link to this post

    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;
                }

  3. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 09 Sep 2013 Link to this post

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