How can I determine if grid is scrolled to the end (thumb is at the bottom of a scroll bar)?
Out of curiosity... why would you need to know when the scroll bar is at the bottom?
If the grid's ScrollBounds is set to the default, then when the scroll bar is at the bottom, there will be only one row visible in the ActiveRowScrollRegion and it will be the last (visible) row of data. So that should be fairly easy to detect.
If ScrollBounds is set to ScrollToFill, then I don't see any easy way to do this.
In my case ScrollBounds is set to ScrollToFill. So I'll stop to search for a solution. Thank you, Mike.
Assuming that your grid is flat (no child bands or grouping, then you can try something like this:
RowScrollRegion rowScrollRegion = this.ultraGrid1.ActiveRowScrollRegion; UltraGridRow lastVisibleRowInRowScrollRegion = null; for (int i = rowScrollRegion.VisibleRows.Count - 1; i >= 0; i--) { UltraGridRow row = rowScrollRegion.VisibleRows[i].Row; UIElement rowElement = row.GetUIElement(rowScrollRegion); if (rowElement != null && rowElement.Parent.Rect.Bottom > rowElement.Rect.Bottom) { lastVisibleRowInRowScrollRegion = row; break; } } UltraGridRow lastRowInGrid = null; for (int i = this.ultraGrid1.Rows.Count - 1; i >= 0; i--) { UltraGridRow row = this.ultraGrid1.Rows[i]; if (false == row.HiddenResolved) { lastRowInGrid = row; break; } } MessageBox.Show(this, "Scrolled to Bottom: " + (lastRowInGrid == lastVisibleRowInRowScrollRegion).ToString());