This example illustrates how to add Event Triggers for DetailsViewDataGrid in WPF DataGrid (SfDataGrid).
In WPF DataGrid (SfDataGrid), EventTriggers added for the DetailsView DataGrid which is defined within the SfDataGrid.DetailsViewDefinition in XAML will not work, as it is not the same UI element which is displayed as the child DataGrid. However, it is possible to add EventTrigger for the DetailsView DataGrid in code behind by using DetailsViewLoading event.
private void OnDataGrid_DetailsViewLoading(object sender, DetailsViewLoadingAndUnloadingEventArgs e)
{
System.Windows.Interactivity.EventTrigger trigger = new System.Windows.Interactivity.EventTrigger();
trigger.EventName = "CellTapped";
InvokeCommandAction action = new InvokeCommandAction();
action.Command = (this.DataContext as ViewModel).CellTappedCommand;
trigger.Actions.Add(action);
trigger.Attach(e.DetailsViewDataGrid);
}
KB article: How to add Event Triggers for DetailsViewDataGrid in WPF DataGrid (SfDataGrid)?
Visual Studio 2015 and above versions.