Skip to main content

Microsoft Silverlight

Answered Question Empty Canvas & Grid control does not fire LeftMouseButtonDown & Up eventRSS Feed

(0)

Galo
Galo

Member

Member

39 points

72 Posts

Empty Canvas & Grid control does not fire LeftMouseButtonDown & Up event

as stated, unless you manualy set the background property to any color except Transparent, it works, otherwhise it does not work!

 Keep up the good work fellaz...

Foo Bar this

bryant
bryant

Star

Star

9907 points

1,629 Posts

Silverlight MVP

Re: Empty Canvas & Grid control does not fire LeftMouseButtonDown & Up event

It doesn't capture the mouse down because there is nothing visually there. You could try setting IsHitTestVisible to true, but I'm not sure that will do anything. Another trick is to set the background to a color but opacity to 0.01. Smile

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft
Answered Question

Re: Empty Canvas & Grid control does not fire LeftMouseButtonDown & Up event

Setting Background="Transparent" on the Canvas should do it (I just verified it). Note that this is different from not setting the background (i.e. Background == null), from a hit-testing perspective.

Thanks, Stefan Wick

Microsoft Silverlight | http://blogs.msdn.com/swick/
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities