Please tell me how to make a unique check, for example, that ellipse is a child of the Grid? ...
private void Window_PreviewMouseDown_2(object sender, MouseButtonEventArgs e) { if ((e.Source as Control).Parent is Grid == true){ // Ура, наш control или ellipse или usercontrol внутри grid'а } } Everything seems easy, but when in e.Source is not a standard System.Windows.Controls , but for example one of System.Windows.Shapes then the program crashes due to the type mismatch, and if there is a user control, then I’m generally afraid to imagine what will happen there :)