I need to get the name of the control that's start an event, in particular I've used a ContextMenu for DataGrid, this is the code that I actually write:

```
private void ClearTable_Click(object sender, RoutedEventArgs e)
{
    // Try to cast the sender to a MenuItem
    ContextMenu menuItem = sender as ContextMenu;
    if (menuItem != null)
    {
        // Retrieve the ContextMenu that contains this MenuItem
        ContextMenu menu = menuItem.GetContextMenu();

        // Get the control that is displaying this context menu
        Control sourceControl = menu.SourceControl;
    }
}

```

**XAML**

```
 <ContextMenu x:Key="Squadre_ContextMenu">
            <MenuItem Header="Pulisci Tabella" Click="ClearTable_Click">
            </MenuItem>
            <MenuItem Header="Elimina Riga selezionata" Click="ClearRow_Click">
            </MenuItem>
        </ContextMenu>

```

but the ContextMenu doesn't have the method GetContextMenu, so this is a problem for me. There's a way to fix this or another way to do this?