winformsvisual-studio-2012gridviewdevexpressxtragrid

DevExpress winform: Get Visible Index of focused row


I am using window forms devExpress extragrid control and I want to get visible row index of the selected row. In the gridview, there are hundreds of the rows, I scroll down and then select first visible row in the grid, it should give me 0 as visible row index. I tried the ways in FocusedRowChange event,

gridView1.GetVisibleIndex(e.FocusedRowHandle)

It should work but surprisingly not working. Can any one help me?


Solution

  • The GetVisibleIndex returns a visible index of a row regardless a scroll position. To calculate a row visible index regarding the top visible row, subtract TopRowIndex from the returned value.