IsHitTestVisible and Opacity in Silverlight 1.0

Jaime Rodriguez
On Windows Phone, Windows Presentation Foundation, Silverlight and Windows 7

IsHitTestVisible and Opacity in Silverlight 1.0

  • Comments 1

I spent last friday "fighting" this breaking change from earlier CTPs , so sharing hoping to save some one else time.. 

In earlier CTPs, UIements with Opacity = 0  were NOT hit testable...  Now, they are [same behavior as WPF]...

So if you have layered controls and are turning them invisible by setting Opacity to 0, make sure you also set the IsHitTestVisible property to false else what is underneath will not get any events...   

A slightly different alternative that I now like is just setting Opacity =0  and moving it some where out of the way ...  like this one better in case I do want items with IsHitTestVisible to false by default..

 

In case you run into it, the symptom was that the control appeared to be freezing ... cause we had canvases or overlays (e.g. ink) on top of what was visible .. so none of the mouse moves/clicks were gettign through ..


There was one good outcome from the exercise.. 

  • Silverlight Cream for May 17, 2007

Page 1 of 1 (1 items)