Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to click an object with Panel.ZIndex low than another in wpf?

Tags:

c#

.net

wpf

c#-4.0

In wpf, i have to click on an image with Panel.ZIndex="1", but this image is "under" another image with a Panel.ZIndex="2". The event MouseDown fail. How to do that?

Thanks in advance, M.

<Grid >
    <Image Name="Image_1" 
           Panel.ZIndex="1" />

    <Image Name="Image_2" 
           Panel.ZIndex="2" />

</Grid>
like image 958
mattpltt Avatar asked Sep 29 '11 10:09

mattpltt


2 Answers

Try using IsHitTestVisible

<Grid >
   <Image Name="Image_1" 
          Panel.ZIndex="1" />

    <Image Name="Image_2" IsHitTestVisible="false" 
          Panel.ZIndex="2" />
</Grid>
like image 120
Ray Avatar answered Oct 14 '22 09:10

Ray


You can have a transparent image on top of all others, and have the click-event on that.

like image 25
Eystein Bye Avatar answered Oct 14 '22 09:10

Eystein Bye