Hi Can someone help me how to know on what cell user click with his mouse?
private void GridMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
DependencyObject source = e.OriginalSource as DependencyObject;
if (source == null)
return;
}
if (source is FrameworkElement)
DataRecordPresenter drp = Infragistics.Windows.Utilities.GetAncestorFromType(source, typeof(DataRecordPresenter), true) as DataRecordPresenter;
if (drp == null)
if (drp.Record != null)
drp.Record.IsSelected = true;
drp.IsActive = true;
DataRecord r = drp.DataRecord;
if (r != null)
Regards,
Saykor
Hi,
I am just checking the progress of this thread. Did you manage to solve this issue or you need further assistance?
Looking forward for your reply.
I have a CellClickAction="SelectRecord" in my grid. I can get the cell value but I want to know on what cell is this value. For example I have a 5 cells. I want to know this cell's value is for Ask or Bid to know what order to open by default.
Work like a charm,
Thank you
Hello Saykor,
You can add the following code in your XamDataGrid’s MouseDoubleClick event in order to get the Cell’s Field’s Name:
CellValuePresenter cvp = Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(CellValuePresenter), false) as CellValuePresenter; string fieldName = cvp.Field.Name;