Occurs when the scroll position changes in a worksheet.
The ScrollPositionChanged event's data class is ScrollPositionChangedEventArgs. The following properties provide information specific to this event:
|ColumnIndex||Gets the index of the left-most column of the currently visible area.|
|RowIndex||Gets the index of the top row of the currently visible area.|
The ScrollPositionChanged event occurs in the following cases:
- When a worksheet is scrolled in code using the Worksheet.ScrollTo, Worksheet.ScrollToColumn or Worksheet.ScrollToRow method.
- When the Worksheet.FreezePanes, Worksheet.FreezeColumns, Worksheet.FreezeRows or Worksheet.UnfreezePanes method is called to create or unlock frozen panes on a worksheet.
Handle this event to determine the name of the worksheet being scrolled and obtain the column and row indexes of the top-left cell of the currently visible area. If a worksheet contains frozen rows and columns, the ColumnIndex and RowIndex properties of the ScrollPositionChangedEventArgs class return indexes of the top-left cell of the currently visible scrollable area.
This event does not occur by default. The event fires only if the WorkbookEventOptions.RaiseOnModificationsViaAPI property is true.