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
close icon

HScrollPixelPosChanged event

Why isn''t the HScrollPixelPosChanged event fired when you if you click a column header and it gets automatically scrolled into view? Is there and equivalent for the column header i.e what event is fired when the column header is automatically scrolled?

Thanks

7 Replies

AD Administrator Syncfusion Team August 31, 2006 10:51 AM UTC

Hi Jay,

The reason is that you are not anable the pixel scrolling of the grid. You can use below code snippet to enable the pixel scrolling.

this.gridControl1.HScrollPixel = true;
this.gridControl1.VScrollPixel = true;

//Occurs before the horizontal pixel scroll position is changed.
private void gridControl1_HScrollPixelPosChanged(object sender, Syncfusion.Windows.Forms.Grid.GridScrollPositionChangedEventArgs e)
{
Console.WriteLine("pixel scrolling postion");
}

Let me know if this helps.
Thanks,
Haneef


AD Administrator Syncfusion Team August 31, 2006 11:00 AM UTC

Hi Haneef,

We already handle HScrollPixelPosChanged but the event is not raised when the column header is selected.

Thanks


AD Administrator Syncfusion Team August 31, 2006 11:29 AM UTC

Hi Jay,

You can use the LeftColChanging event to detect the scroll position changes when the column is clicked. Here is a code snippet.

//form Load....
this.grid.LeftColChanging += new GridRowColIndexChangingEventHandler(this.LeftColChanging);

private void LeftColChanging(object sender, GridRowColIndexChangingEventArgs e)
{
Console.WriteLine("Fired");
}

Thanks,
Haneef


JA Jay August 31, 2006 11:46 AM UTC

Thanks. I have already tried that. When the main grid position changes I need to realign two other grids. In HScrollPixelPosChanged we do the following:

private void gridMain_HScrollPixelPosChanged(object sender, GridScrollPositionChangedEventArgs e)
{
try
{
// Scroll to new position
this.gridTotals.SetCurrentHScrollPixelPos( gridMain.GetCurrentHScrollPixelPos() );
this.gridFilters.SetCurrentHScrollPixelPos( gridMain.GetCurrentHScrollPixelPos() );

However, this didn''t work from LeftColChanging event. Any other ideas?


AD Administrator Syncfusion Team August 31, 2006 12:34 PM UTC

Hi Jay,

The reason is that the LeftColChanging event occurs before the grid is scrolled when the left column index is changed. Try the same code in LeftColChanged event and Let me know if this helps.

private void LeftColChanged(object sender, GridRowColIndexChangedEventArgs e)
{
// Scroll to new position
this.gridTotals.SetCurrentHScrollPixelPos( gridMain.GetCurrentHScrollPixelPos() );
this.gridFilters.SetCurrentHScrollPixelPos( gridMain.GetCurrentHScrollPixelPos() );
}

Thanks,
Haneef



JA Jay August 31, 2006 02:06 PM UTC

Sorry I wasn''t clear. I have already tried your suggestion in LeftColChanging.


JA Jay August 31, 2006 02:08 PM UTC

Apologies. I didn''t read your last post correctly. I will try your suggestion in LeftColChanged event.

Loader.
Live Chat Icon For mobile
Up arrow icon