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 } } }
Paul,
If you need some logic that would fire each time you click on a record, no matter of the order of clicking, you probably want to handle for example PreviewMouseLeftButtonDown event of the DataRecordPresenter.
You can do that with the EventManager.RegisterClassHandler(...) method or with a style and EventSetter.
So, if I wanted to cause some form of refresh based on a record in a grid (clicking / selecting causing the refresh) how could I do this if the record being clicked is already selected?
Thanks
Paul
This is correct, they should not fire if you are clicking on already an active record.
Just to piggy-back off this..
If the record is already selected, none of the Activating, Activated, SelectedItemChanging or SelectedItemsChanged events fire (at least with 9.1 - can't say for 9.2).
Is this correct?
If you click on a record, both RecordActivating and RecordActivated events will fire, together with the SelectionChanged pair of events. Maybe you should use a boolean variable to distinguish between the two types of selections.