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

How to click on group header bar to collapse expand?

2 Answers 156 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stanley
Top achievements
Rank 1
Stanley asked on 26 May 2012, 04:32 AM
How to click on group header bar to collapse expand?

Just to make more user friendly, let the user click on group header bar to collapse expand the list rather than click on the small button.

Is possible?
Please refer the picture from attachment.

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Petrov
Telerik team
answered on 30 May 2012, 12:22 PM
Hello Stanley,

Thank you for writing.

You can achieve this behavior through the CellClick event. You have to check whether the user has clicked on a group row and collapse/expand the row. Here is a code snippet which demonstrates this:
this.radGridView1.CellClick += new GridViewCellEventHandler(radGridView1_CellClick);
 
void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
  if (e.Row is GridViewGroupRowInfo)
  {
    e.Row.IsExpanded = !e.Row.IsExpanded;
  }  
}

I hope this will be useful for you. Should you have further questions, I would be glad to help.
 
All the best,
Ivan Petrov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Stanley
Top achievements
Rank 1
answered on 31 May 2012, 02:19 AM
Thanks for help.

The small icon cannot work properly, need to add in one more condition
sender.GetType().ToString() == "Telerik.WinControls.UI.GridGroupContentCellElement")

if (e.Row is GridViewGroupRowInfo &&
    sender.GetType().ToString() == "Telerik.WinControls.UI.GridGroupContentCellElement")
{
    e.Row.IsExpanded = !e.Row.IsExpanded;
}
Tags
GridView
Asked by
Stanley
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Stanley
Top achievements
Rank 1
Share this question
or