Hi
I have a Windows Form with an sfDataGrid and I want to programatically scroll it to the bottom when it loads.
I've looked at the following article but I have an issue with it:
The rows in my grid are of variable height and I'm using a QueryRowHeight event to set the row heights.
Here is my form when displayed:
If I then click my button which call:
sfDataGrid1.TableControl:ScrollRows:ScrollInView(sfDataGrid1.RowCount)
sfDataGrid1.TableControl.UpdateScrollBars()
it doesn't scroll all the way to the bottom - there are still a couple of rows below the scroll point:
If I manually scroll it down you can see the other two lines in the table:
How do I get it to scroll all the way to the bottom?
Leigh
Hi Leigh Anderson,
Currently, we are checking the feasibilities to achieve your requirement. We
will check and update you further details on April 26, 2022. We appreciate your
patience until then.
Regards,
Dhanasekar M.
Hi Leigh Anderson,
With custom row heights using QueryRowHeight event, the row heights change eventually based on
the data whenever the rows coming to view, so that the size of the scroll bar
will change based on current size of the rows. Since the scroll bar size vary
periodically due to rows unknown size, we can’t scroll to particular scroll row
positions programmatically and this is the default behavior.
Regards,
Dhanasekar M.
Hi
I just want to be able to scroll to the bottom - don't really need to scroll to a particular row.
Is there any way to do that?
Or even just the option to scroll to a particular number of pixels down?
Thanks
Leigh
Hi Leigh Anderson,
Currently, we are checking the feasibilities to achieve your requirement. We
will check and update you further details on April 29, 2022. We appreciate your
patience and understanding.
Regards,
Dhanasekar M.
Hi Leigh Anderson,
You can achieve your requirement by using LineHiddenChanged event like below,
|
this.sfDataGrid.TableControl.RowHeights.LineHiddenChanged +=
RowHeights_LineHiddenChanged; { if(moveScrollToBottom) { this.sfDataGrid.TableControl.ScrollRows.ScrollBar.Value = this.sfDataGrid.TableControl.ScrollRows.ScrollBar.Maximum; this.sfDataGrid.TableControl.UpdateScrollBars(); } moveScrollToBottom = false; } |
We have prepared the sample based on your scenario. Please check this and
revert us if you need further assistance.
Regards,
Dhanasekar M.