Hi,
Is there a way to retrieve the viewing last row index easily?
I able to retrieve the viewing first row index through below code:
int
but then i found out that LastRow were a Non public member(pls view the image url below) and I couldnt access to retrieve it.
If you want to show the correct values when you load the form, handle the grid AfterRowRegionSize event. If you call GetRowIndex in the constructor, it won't give the correct values since the grid wasn't shown yet.
1. It isn't correct in any position. It always says that you see another row that you don't really see. You subtracted 1 from the index and that's why you don't get the real index for the last row. This problem should be checked.
2. It's ok here. We don't use the same version. I use 10.2.2064.
Hi, appreciate your reply.. i did a small app, please open and check it out..
it does return correct value if i scroll it..
but
http://cid-1b74085fe9a2e1fd.office.live.com/self.aspx/Public/WindowsFormsApplication4.zip
You can write instead of:
hongheng said:a = this.ultraGrid1.ActiveRowScrollRegion.VisibleRows.RowScrollRegion.FirstRow.VisibleIndex;
this:
this.ultraGrid1.ActiveRowScrollRegion.FirstRow;
About your question, if the VisibleRows are ordered by index, you could simply write:
grid.ActiveRowScrollRegion.VisibleRows[grid.ActiveRowScrollRegion.VisibleRows.Count - 1].Row.Index;
If they are not ordered, you can query the last index:
grid.ActiveRowScrollRegion.VisibleRows.OfType<VisibleRow>().Max(vr => vr.Row.Index);