is there any event which is raised when mouse is click on a record or cell? I am familiar with record activating/activated event, but it does not solve my purpose. I am looking for a mouse event.
I used PreviewMouseDown event as below, but does not help when I mouse click on deactive records.
protected internal virtual void LookupGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e) { DependencyObject source = e.OriginalSource as DependencyObject; if (source == null) return;
DataRecordPresenter drp = Infragistics.Windows.Utilities.GetAncestorFromType(source,typeof(DataRecordPresenter), true, this.LookupDataGrid) as DataRecordPresenter; if (drp != null) { //--drp is not NULL when clicked any where in xmlDataGrid if(drp.IsActive) { // - when clicked on the active record but not on other records } } }
When you click on the DataRecordPresenter, couple of events will fire - RecordActiveting/ed and SelectedItemChanging/ed. If you want to be able to select the Record right away with click, you can set the CellClickAction to SelectRecord.
Please give us more information on what you are trying to achieve and why this PreviewMouseLeftButtonDown event is not working for you?
Thanks
I have CellClickAction set to SelectRecord and it is non-editable xamDatagrid. The only thing I need to do is record selection. Record can be selected by 2 ways: clicking the record and entering a value in the textbox that existing in any of the datagrid cells. textbox is placed above the datagrid. So on text change, I check for each cell in datagrid to find if the value and first matching value, I select that record and do few other functionality. To do this, I m listening to RecordActivated event.But there is some additional functionality I need to do when user has selected a record by clicking on it (and not by entering a value in the textbox) after the record is selected in the xamdatagrid.