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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Scrolling to a non-visible cell in a GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

59216 Apr 6,2007 05:08 PM UTC Apr 9,2007 09:33 AM UTC WinForms 1
loading
Tags: GridControl
Steve Loughin
Asked On April 6, 2007 05:08 PM UTC

I'm working with a GridDataBoundGrid and I have a graph that is showing the same data as a plot. When a user clicks on a graph Point, that is translated to the corresponding grid cell.

I wanted to determine if this cell is currently visible in my GridDataBoundGrid, and if not, scroll to it so it is visible. The solution, though difficult to find in the KnowledgeBase and Forum, was actually pretty simple. I am posting here to share this code in case others also find this helpful:

if ( _lastHilite != oldHilite ) // hilite changed
{
GridRangeInfo test= GridRangeInfo.Cell(_lastHilite.X, _lastHilite.Y);

GridRangeInfo gri = this._gridControl.ViewLayout.VisibleCellsRange;
bool visible = gri.Contains ( test );

if ( ! visible )
{
this._gridControl.ScrollCellInView ( test );
}
}
this._gridControl.Refresh(); // force a repaint

haneefm [Syncfusion]
Replied On April 9, 2007 09:33 AM UTC

Hi Steve,

You should call the Refresh() method before calling ScrollCellInView method and should turn ON the pixel scrolling of the grid by setting XScrollPixel to true. Please try the suggestion and let me know if this helps.

this._gridControl.VScrollPixel = true;
this._gridControl.HScrollPixel = true;

if ( _lastHilite != oldHilite ) // hilite changed
{
GridRangeInfo test= GridRangeInfo.Cell(_lastHilite.X, _lastHilite.Y);

GridRangeInfo gri = this._gridControl.ViewLayout.VisibleCellsRange;
bool visible = gri.Contains ( test );

this._gridControl.Refresh(); // force a repaint
if ( ! visible )
{
this._gridControl.ScrollCellInView ( test );
}
}

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;