private void image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { var btn = sender as Image; if (SmilieSelected != null) { if (btn != null) { SmilieSelected(this, new SmilieSelectedEventArgs(PNStatic.ImageToDrawingImage(btn.Source as BitmapImage))); } } DialogResult = true; } catch (Exception ex) { PNStatic.LogException(ex); } }