I have a Custom UIElement I created below.
class ClickItem : UIElement
{
public ClickItem()
{
}
public ClickItem(Color color)
{
this.Color = color;
Ellipse _e = new Ellipse();
_e.Fill = new SolidColorBrush(this.Color);
_e.StrokeThickness = 1;
_e.Stroke = Brushes.Black;
_e.Width = 10;
_e.Height = 10;
this.Plotter = _e;
}
public Point CenterPoint { get; set; }
public Ellipse Plotter { get; set; }
public Color Color { get; set; }
}
How do I make the Plotter Ellipse the visual for the UIElement so when I add a ClickItem to a canvas, the `Plotter' shows up.
Canvas canvas = new Canvas();
ClickItem clickItem = new ClickItem(Colors.Red);
canvas.Add(clickItem);
I can do this but I don't know how to get the ClickItem from this if I click on it.
canvas.Add(clickItem.Plotter);