Tuesday, September 4, 2012

Effects (DropShadowEffect) in Windows Phone 7

Effects (DropShadowEffect) in Windows Phone 7

I noticed the Effect Property is missing in Silverlight for Windows Phone 7 so I did some googling and apperently it was dropped due to performance reasons. I basically want to do something like this

<TextBlock ...>     <TextBlock.Effect>         <DropShadowEffect/>     </TextBlock.Effect> </TextBlock> 

And

<Image ...>     <Image.Effect>         <DropShadowEffect/>     </Image.Effect> </Image> 

So is there some other way to get a DropShadowEffect in Silverlight for Windows Phone 7? And are there any news if it'll be in the next release?

Thanks

Answers & Comments...

Answer: 1

With the image you can just simply create a drop shadow in Photoshop/Gimp etc (works well for me) and save it as .png.

With TextBlock it is a bit harder. For instance, create a half-transparent image with the shadow and place both TextBlock and the Image inside the Canvas. Change the Canvas.ZIndex="integer" attached property to place them in a specific order - image has to be underneath. Also shadow should be blurred.

The drawbacks are:

  • Shadow is static.
  • Doesn't really suit metro UX.
by : lukashttp://stackoverflow.com/users/336186

Answer: 2
<TextBlock ...>  <TextBlock.RenderTransform>   <TranslateTransform X="3" Y="3" />  </TextBlock.RenderTransform> </TextBlock>  <TextBlock ...> </TextBlock> 

Sorry a newbie here. Wanted shadow effect and this worked for me. You need to put same content in both textblocks (except textblock name). X and Y are the horizonatal and vertical distance of shadow from text. You can also use negative numbers if depending on position of shadows.

by : Tushar Jainhttp://stackoverflow.com/users/1645336




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog