AD
Administrator
Syncfusion Team
April 4, 2005 09:47 PM UTC
Anthony,
The following code should do it:
this.groupingGrid1.TableControlCellButtonClicked += new GridTableControlCellButtonClickedEventHandler(groupingGrid1_TableControlCellButtonClicked);
private void groupingGrid1_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
{
if (!style.TableCellIdentity.DisplayElement.ParentGroup.IsExpanded)
{
GridTableControl tc = this.groupingGrid1.TableControl;
int leftColIndex = tc.LeftColIndex;
bool isFullyVisible = tc.GetCurrentHScrollPixelDelta() == 0;
if (!isFullyVisible)
leftColIndex++;
if (leftColIndex > tc.CurrentCell.ColIndex)
{
tc.CurrentCell.MoveTo(tc.CurrentCell.RowIndex, leftColIndex);
style.TableCellIdentity.DisplayElement.ParentGroup.IsExpanded = true;
e.Inner.Cancel = true;
}
}
}
}
Stefan
>A user performs the following actions:
>1- Selects the first or second column in a summary row in a grid (via mouse-click, making it the current cell in the grid).
>2- Scrolls the grid horizontally to about the grid''s midpoint (width).
>3- Expands the summary row by clicking on the ''+'' sign which is a frozen column(hence always visible).
>
>The grid then ignores the user''s scrolled position and returns to the selected row (undoing the user''s scrolling).
>
>What I''d like to do is move the current cell to the the column the user scrolled to (while staying in the same row) when the user clicks a summary row for expansion.
>
>thanks.