To add a click event to a Button in C# code behind, I can do this
Button btn = new Button;
btn.Click += btn_Click;
What if I have an Ellipse, which does not contain a Click?
Ellipse e = new Ellipse;
e.??? += e_Click;
One way to do that is make button an ellipse and attatch .Click Event handler.
<Button>
<Button.Template>
<ControlTemplate>
<Ellipse .../>
</ControlTemplate>
</Button.Template>
</Button>
Maybe the MouseUp event will serve your purpose. Try
Ellipse ellipse = new Ellipse();
ellipse.MouseUp += ellipse_MouseUp;
private void ellipse_MouseUp(object sender, MouseButtonEventArgs e)
{
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With