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
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;
Hi,
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.
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.
Thank you for your post. I have been looking through it and I believe that you can use the CellClickAction Property of the XamDataGrid’s FieldSettings. Here are described the possible values for it:
http://help.infragistics.com/NetAdvantage/WPF/2011.1/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v11.1~Infragistics.Windows.DataPresenter.CellClickAction.html
If it is set to SelectRecord on Click you select the Record and on DoubleClick you select the Cell and enter in EditMode if it is allowed. Please let me know if this is what you are trying to achieve or you need further clarifications on this matter.