How to get the first column

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

I need to know the number of the row visible inside the
data grid, this is exactly like what the

DataGrid.FirstVisibleColumn

property does, but I want to do it for
the "FirstVisibleRow". This is NOT necessarily the first
row in the dataSource, as when the user scrolls to some
arbitrary point in the dataSource (say dataSet or
dataTable) I want to be able to programmatically get hold
of the first row that is visible within the dataGrid.

Your help is most appreciated.

Thank you.
 
Hello Al,

As you have probably found out, there is no such a property available.
However, I think this can be achieved by determining the "y" coordinate of
the current row (through the GetCurrentCellBounds method) and then try to
calculate the first visible row basing on VisibleRowCount (you might also
have to do additional "probing" with GetCellBounds after you have calculated
the potentially first visible row).
 
I have actually tried this approach but get stuck at the
point of how, knowing the cellBound information, I get
hold of the row information, in particular the row number.

I know the first visible row in the grid is located at eg
x=42, y=35, i can also get the width/height of this first
cell. how do i get the row number?

You assistance is appreciated.

Al
-----Original Message-----
Hello Al,

As you have probably found out, there is no such a property available.
However, I think this can be achieved by determining the "y" coordinate of
the current row (through the GetCurrentCellBounds method) and then try to
calculate the first visible row basing on VisibleRowCount (you might also
have to do additional "probing" with GetCellBounds after you have calculated
the potentially first visible row).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

Al said:
I need to know the number of the row visible inside the
data grid, this is exactly like what the

DataGrid.FirstVisibleColumn

property does, but I want to do it for
the "FirstVisibleRow". This is NOT necessarily the first
row in the dataSource, as when the user scrolls to some
arbitrary point in the dataSource (say dataSet or
dataTable) I want to be able to programmatically get hold
of the first row that is visible within the dataGrid.

Your help is most appreciated.

Thank you.

.
 
No need to reply to this one... I've solved it...Yephee.
-----Original Message-----
Hello Al,

As you have probably found out, there is no such a property available.
However, I think this can be achieved by determining the "y" coordinate of
the current row (through the GetCurrentCellBounds method) and then try to
calculate the first visible row basing on VisibleRowCount (you might also
have to do additional "probing" with GetCellBounds after you have calculated
the potentially first visible row).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

Al said:
I need to know the number of the row visible inside the
data grid, this is exactly like what the

DataGrid.FirstVisibleColumn

property does, but I want to do it for
the "FirstVisibleRow". This is NOT necessarily the first
row in the dataSource, as when the user scrolls to some
arbitrary point in the dataSource (say dataSet or
dataTable) I want to be able to programmatically get hold
of the first row that is visible within the dataGrid.

Your help is most appreciated.

Thank you.

.
 
Back
Top