private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Image image = sender as Image; if (image != null) { Position pos = image.DataContext as Position; if (pos != null) { if (pos.Name.StartsWith("OL")) { Setting.ClearOffBall(); } if (pos.Name.StartsWith("DL")) { Setting.ClearDefBall(); } pos.HasBall = true; } } }