Using the HitTestInfo class in conjunction with HitTest I can get the row and
column on a DataGrid. Now is what I would like is to translate that row and
column to the row and column on the DataSource (in this case it is a
DataTable). Any ideas?
One more question. I think this article assumes that the user has clicked on
a particular row to make it current. I am using HitTest from within MouseMove
so I don't think I can make any assumptions about the "current" postion.
HitTest seems to do the work of translating the coordinates of the mouse to
row and column numbers in the DataGrid. I just need to translate those row
and column numbers to row and column numbers of the assocated table.
I spent some time working on this issue. One of the things I realized is that
if we are looking at the data then we will never get a live picture of what
is happening in the cell.
What we need to understand is where in the architecture the data is being
modified. It is in a textbox in the DataGridTextBoxColumn ( DGTBC ). To get
to the data as it is being typed in this textbox we can create a class
derived from ( DGTBC ).
You are correct this article gives you the row number that is selected. The
currencymanager is bound to the datagrid. The current property of the
currency manager returns the currently selected datarow.
You can use the column information from the HitTest to retreive the data.
If you add the Global class that is in the article to your application then
use it like this.