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>
source share