Hello. I want to create a UIElement containing, for example, 2 standard ellipses:
public class MyUI : UIElement { Ellipse el; Ellipse el1; public MyUI(Canvas canv) { Random rnd = new Random(); el = new Ellipse(); el1 = new Ellipse(); el.Width = 30; el1.Width = 30; el.Height = 30; el1.Height = 30; el.Fill = Brushes.Green; el1.Fill = Brushes.Red; canv.Children.Add(el); canv.Children.Add(el1); Canvas.SetTop(el, rnd.Next(300)); Canvas.SetTop(el1, rnd.Next(300)); Canvas.SetLeft(el, rnd.Next(300)); Canvas.SetLeft(el1, rnd.Next(300)); } } Tell me how to create a mouse click event on my element (let's call it MyUI_MouseLeftButtonDown), which will be triggered when clicking on one of the ellipses? I suspect that you can somehow use the standard Ellipse_MouseLeftButtonDown events for each of the ellipses.