0

今、私はWindows Phone 7のアプリケーションでgif画像を再生しています。このコードxmlを試しました

  `xmlns:imagetools="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls" '
<phone:PhoneApplicationPage.Resources>
        <imagetools:ImageConverter x:Key="ImageConverter" />
    </phone:PhoneApplicationPage.Resources>



`<imagetools:AnimatedImage Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}" /`>

とc#

 try
            {
                ImageSource = new Uri("file:///C:/Users/sram.I-WAVES/Desktop/S&L_BB/Dice%20anim/dice_anim_1.gif", UriKind.RelativeOrAbsolute);
                ImageTools.IO.Decoders.AddDecoder<ImageTools.IO.IImageDecoder>();
                this.DataContext = this;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

しかし、「アセンブリ 'mscorlib、バージョン = 3.7.0.0 から 'System.Diagnostic.Contracts.ContractFailurekind' を読み込めませんでした。Culture=neutral,PublicKeyToken=969DB8053D3322AC'」のような例外がスローされます。この問題を解決する方法と、Windows Phone で gif 画像を再生するにはどうすればよいか教えてください。

前もって感謝します。

4

1 に答える 1

3

画像をプロジェクトに追加し、それを設定して、画像へBuildActionContent相対パスを使用します。

ImageSource = new Uri("/path-to-the-image-inside-the-project/dice_anim_1.gif", UriKind.RelativeOrAbsolute);
于 2013-05-29T08:14:24.607 に答える