view gif image in image UI control windows phone 7
NickName:Nghia Nguyen Ask DateTime:2011-08-26T16:03:39

view gif image in image UI control windows phone 7

I want to display the gif image in the UI image control.

I have Image image1;

image1.source = new BitmapImage(new Uri(link, UriKind.Absolute));

but the link in Uri is a .gif image.

I have read this: imagetool however I still not get it how to use the library. I did download the library and add references, then from that I'm stuck, I want to set source in code. Can you help explains it a little bit more?

My code currently like this:

<UserControl.Resources>
    <imagetools:ImageConverter x:Key="ImageConverter" />
</UserControl.Resources>

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid HorizontalAlignment="Right" Width="69">
        <Border  BorderBrush="White" BorderThickness="3" CornerRadius="7" Background="Black">
            <Image  Width="69" Height="69" Name="canvasImage" Stretch="UniformToFill" HorizontalAlignment="Center" VerticalAlignment="Center" ImageFailed="canvasImage_ImageFailed" />
        </Border>
        <Border  BorderBrush="White" BorderThickness="3" CornerRadius="7" Background="Black">
            <imagetools:AnimatedImage  Name="canvasGifImage" Width="69" Height="69" Stretch="UniformToFill" HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Border>
    </Grid>
</Grid>

        In my MainPage.xaml.cs, because I don't know whether it is an png/jpg or a gif, so I have it try to load png/jpg first, if failed then try load gif in the imagetools control name canvasGifImage:

        private void DisplayImage(int index, string link)
    {
        try
        {
            control1.canvasImage.Source = new BitmapImage(new Uri(link, UriKind.Absolute));
        }
        catch //if fail to load image as normal, do this
        {
            //but I dont know how to set Source for the canvasGifImage, help me here:

            control1.canvasGifImage.Source = *new BitmapImage(new Uri(link, UriKind.Absolute));*

        }
    }

Copyright Notice:Content Author:「Nghia Nguyen」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7201693/view-gif-image-in-image-ui-control-windows-phone-7

More about “view gif image in image UI control windows phone 7” related questions

view gif image in image UI control windows phone 7

I want to display the gif image in the UI image control. I have Image image1; image1.source = new BitmapImage(new Uri(link, UriKind.Absolute)); but the link in Uri is a .gif image. I have read ...

Show Detail

how to display the gif image in windows phone by not using web browser

how to show the gif image in windows phone 7, i tried from many site, but they have done only by using web browser to view the gif image. now i want to view the gif image by not using of web browser

Show Detail

How to do gif-like animation in windows phone 7?

I am a beginner with Windows Phone. According to my information, Windows Phone 7 does not support .gif images and I want to display animated images like [.gif] image in my Windows Phone application...

Show Detail

how to display a gif image in windows phone 7?

i am trying to load images from facebook. if a user has set a profile picture, then the picture is a jpg, however, if a user has not set one, then the picture is a stub image in gif format. i know ...

Show Detail

What control to use to display larger image on Windows Phone 7

I would like to display a larger image on a windows phone 7 device. I need to be able to zoom in and out using multi-touch gesture. I was wondering if there is any control that can do this out of t...

Show Detail

how to block user interaction to image control in windows phone 7?

How to Block the user interaction for image control or object in windows phone7?

Show Detail

Perform function if user thumb is on image - Windows Phone 8.1

I am developing Windows Phone 8.1 application (XAML, C#). In my UI, I have a image control. When the user taps on this image, I want to display a gif in place of that image until user pull off his ...

Show Detail

How to add image on calendar control in windows phone

I am new to the Windows phone application development, I am using windows phone 7 calendar control in my application. I want to add a small image on a cell of calendar on particular date. Is it pos...

Show Detail

Does Windows Phone 8 support GIF images?

I recently was able to successfully set an Image's source as a GIF image, using: image.Source = new BitmapImage(new Uri("http://imageurl/image.gif") I currently have to use a substantial amount of

Show Detail

Binding Image stored in the Isolated Storage to Image Control in Windows Phone

Is it possible to bind the image present in the Isolates storage to image control through xaml. I found some implementations like getting the image through the property and binding that into xaml c...

Show Detail