Expand and collapse nested grid with a parent row click

2 posts, 0 answers
  1. daddo
    daddo avatar
    4 posts
    Member since:
    Apr 2016

    Posted 18 May 2016 Link to this post

    I have a nested grid and I want to expand it and collapse it with a parent row click. It expands with parent row click per default but if i want to close it (collapse it) i have to hold crtl. I want to be able to collapse it again on the parent row click without holding crtl button. How is that possible? Thanks
  2. Yoan
    Yoan avatar
    1128 posts

    Posted 20 May 2016 Link to this post


    You can change the visibility of the RowDetails manually like so:
    this.clubsGrid.AddHandler(GridViewDataControl.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnLeftButtonDown), true);
        private void OnLeftButtonDown(object sender, MouseButtonEventArgs e)
            var row = (e.OriginalSource as FrameworkElement).ParentOfType<GridViewRow>();
            if (row != null)
                if (row.DetailsProvider.Visibility == Visibility.Visible)
                    row.DetailsVisibility = Visibility.Collapsed;
                    row.DetailsVisibility = Visibility.Visible ;

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top