Reputation: 27
I have 2 DataGrid's.
<DataGrid x:Name="dataGrid1" />
<DataGrid x:Name="dataGrid2" />
Is it possible to get the xaml Name of the DataGrid I'm currently on from a MouseMove event?
Thanks!
Edit: I'm using a third party source - Syncfusion in order to create a SfDataGrid.
Upvotes: 1
Views: 293
Reputation: 1647
try this:
ABC.xaml
<SfDataGrid x:Name="dataGrid1" MouseEnter="DG_OnMouseEnter" />
<SfDataGrid x:Name="dataGrid2" MouseEnter="DG_OnMouseEnter" />
ABC.xaml.cs [CodeBehind]
private void DG_OnMouseEnter(object sender, MouseEventArgs e)
{
Debug.WriteLine(((FrameworkElement) sender).Name);
if (sender is SfDataGrid) e.Handled = true; //prevent event-execution of childs
}
Upvotes: 1