User (Old forums)MemberJanuary 13, 2012 at 10:02 amPost count: 23064
How Could i find the rows which are visible ?
for example , i added 100 rows, and at a time there are 40 -45 rows are visible.
by programming, how could i get the visible row numbers /count.
If i scroll down/ up in that case it should very , i could find the first visible row but number of visible rows / last visible row is not avaiable.
Could you help me out.
Imported from legacy forums. Posted by Kunal (had 2029 views)Xceed SupportMemberJanuary 16, 2012 at 11:07 amPost count: 5658
I have created a method that returns the total number of rows that is available on screen. The GetNumberOfRowsInGrid will return the total number of rows available on screen. In the first part of my code, you can place the DataRows inside a collection.
int FirstVisibleRowIndex = gridControl1.DataRows.IndexOf(this.gridControl1.FirstVisibleRow as Xceed.Grid.DataRow);
BindingList<Xceed.Grid.DataRow> VisibleRows = new BindingList<Xceed.Grid.DataRow>();
for (int i = 0; i < GetNumberOfRowsInGrid(); i++)
private int GetNumberOfRowsInGrid()
int RowHeight = this.gridControl1.DataRowTemplate.Height;
int RectangleHeight = (this.gridControl1.DisplayRectangle.Height – (this.groupByRow1.Height + this.columnManagerRow1.Height));
return (RectangleHeight / RowHeight);
I hope this helps 🙂
Imported from legacy forums. Posted by Marc [Xceed] (had 208 views)User (Old forums)MemberJanuary 18, 2012 at 5:36 amPost count: 23064
Thanks Marc for reply,
Is this going to support if few grids are having data with multiple lines / different height ?
i.e. the data in first 3 rows are “abcd” — height = 25
4th row is having some data like “abcd /r/n efgh” —height =35.
then after few rows say for example
10th row is having some data like “abcd /r/n efgh /r/n xyxs” —height =50.
or this will work with common height only ?
Imported from legacy forums. Posted by Kunal (had 293 views)Xceed SupportMemberJanuary 19, 2012 at 9:48 amPost count: 5658
If there are different heights, then this method will not work. Another way of doing it would be to get the sorted DataRows (rows as they are sorted to the user on the screen) and check their heights individually and check to see if the accumulated height is less than the height of the rectangle. If it is, continue the loop. If it is not, then you can stop.
Imported from legacy forums. Posted by Marc [Xceed] (had 1111 views)
- You must be logged in to reply to this topic.