Hi @winphonegeek

http://windowsphonegeek.com/tips/changing-the-wp7-panorama-background-image-dynamically-with-animation

don’t do it…

(Panorama.Background).(Brush.Opacity) –> you animate it and get choppy animation

but you want to awesome fade in image animation on panorama’s background ?

Jeff Wilcox have some solutions

http://www.jeff.wilcox.name/2010/11/wp7-panorama-smooth-background-changing/

but

the code for transition is super complicated…

solution?

01. Add image

<Grid x:Name="LayoutRoot">
 <Image x:Name="image"></Image>
 <controls:Panorama x:Name="panorama" Title="my application">
 <!--Panorama item one-->
 <controls:PanoramaItem Header="item1">
 <Grid/>
 </controls:PanoramaItem>
 <!--Panorama item two-->
 <controls:PanoramaItem Header="item2">
 <Grid/>
 </controls:PanoramaItem>
 </controls:Panorama>
 </Grid>

02. Create fade in animation (see winphonegeek tutorial on it) and target the image

//on animation complete, set
panorama.Background = new ImageBrush() { ImageSource = image.Source };
 image.Visibility = System.Windows.Visibility.Collapsed;

03.

 image.Stretch = Stretch.Fill;
 image.Width= [your actual image width here]
 image.Height=[your actual image height here]
//don't forget to handle if the orientation is changed !

04.

image.ImageOpened+=(s,e)=>
 {
 //play fade in animation
 };

done !

Advertisements