WPF Is it possible to use the ellipse "rectangular borders"?

Is it possible to perform a test for getting into the rectangle associated with an ellipse, as in this image ?

enter image description here

+5
source share
1 answer

you can put them in the border grid and check if it was clicked

XAML:

<Grid MouseDown="Border_MouseDown"> <Rectangle Width="100" Height="100" Fill="Green" /> <Ellipse Width="100" Height="100" Fill="Orange" /> </Grid> 

Code for

  private void Border_MouseDown(object sender, MouseButtonEventArgs e) { MessageBox.Show("hit it"); } 

EDIT In order to do this, only XAML for green areas appears here:

  <Grid> <Rectangle Width="100" Height="100" Fill="Green" MouseDown="Border_MouseDown" /> <Ellipse Width="100" Height="100" Fill="Orange" /> </Grid> 
+6
source

All Articles