We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Preventing the focus rectangle from moving to the adjacent CaptionCell when I click the plusminus arrow

Everytime that I click the plus/minus arrow, the focus rectangle moves to the adjacent caption summary cell. How can I prevent this?

Clicking on the plus minus cell shouldn't move focus to the adjancent caption summary cell becuase that would suggest it was the record that the user clicked on or used the arrow key to navigate to. If I disabled the caption summary text to prevent this, then I run into the other problem of that cell NOT having the focus rectangle when the user click on it.

Please help.


3 Replies

RA Rajagopal Syncfusion Team May 16, 2007 09:18 PM UTC

Hi James,

To avoid this from happening, please try the code below in the TableControlDrawCurrentCellBorder event handler of the GridGroupingControl.

void gridGroupingControl1_TableControlDrawCurrentCellBorder(object sender, GridTableControlDrawCurrentCellBorderEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell ||
style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
{
e.Inner.Cancel = true;
}
}

Let us know if you have any further questions.
Regards,
Rajagopal


JB James Blibo May 17, 2007 03:10 AM UTC

How does this snippet solve my problem?

My question was -> when I click the PlusMinusCaption cell to expand or collaspe a group, the ggc is automatically selecting the the first CaptionSummary cell. I do not want that to happen. I have a flat datasource which is group by one field.

The solution you provided simply prevent all cells in the Caption summary row from showing the focus rectangle. This is not what I desire.


RA Rajagopal Syncfusion Team May 17, 2007 09:09 PM UTC

Hi James,

Sorry for the inconvenience. Please try the code below in the TableControlMouseDown and TableControlDrawCurrentCellBorder respectively. This will help you in achieving the desired behavior.

bool flag = false;
void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
GridTableCellStyleInfo styleInfo = e.TableControl.PointToTableCellStyle(pt);
if (styleInfo.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
flag = true;
else
flag = false;
}

void gridGroupingControl1_TableControlDrawCurrentCellBorder(object sender, GridTableControlDrawCurrentCellBorderEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell ||
style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell && flag)
{
e.Inner.Cancel = true;
}
}

Let us know if you have any other questions.
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon