How to make smooth transition from a WebBrowser control to an Image in Silverlight 4?

Posted by Trex on Stack Overflow See other posts from Stack Overflow or by Trex
Published on 2011-01-31T15:23:06Z Indexed on 2011/01/31 15:26 UTC
Read the original article Hit count: 221

Filed under:
|
|

Hi,
I have the following XAML on my page:

`<Grid x:Name="LayoutRoot">  
        <Viewbox Stretch="Uniform">  
        <Image x:Name="myImage" />  
    </Viewbox>  
    <WebBrowser x:Name="myBrowser"  />  
</Grid>`  

and then in the codebehind I'm switching the visibility between the image and the browser content:

myBrowser.Visibility = Visibility.Collapsed;
myImage.Source = new BitmapImage(new Uri(p));
myImage.Visibility = Visibility.Visible;

and

myImage.Visibility = Visibility.Collapsed;
myBrowser.Source = new Uri(myPath + p, UriKind.Absolute);
myBrowser.Visibility = Visibility.Visible;

This works fine, but what the client now wants is a smooth transition between when the Image is shown and when the browser is shown. I tried several approaches but always ran into dead end. Do you have any ideas?

I tried setting two states using the VSM and than displaying a white rectangle on top as an overlay, before the swap takes place, but that didn't work (I guess it's because nothing can be placed above the WebBroser???) I tried setting the Visibility of the image control and the webbrowser control using the VSM, but that didn't work either. I really don't know what else to try to solve this simple task.

Any help is greatly appreciated.
Jan

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about transitions