2017-07-02 91 views
0

我想在我的應用程序,以顯示從下列網址這個GIF:如何使用XAML從UWP中的URL顯示GIF圖像?

Click here

我無法通過傳統工藝實現這一點,它只是顯示沒有任何動畫圖像。

+0

這可能是烏拉圭回合的應用程序,以顯示GIF的問題,因爲瀏覽器通常支持GIF格式 – moh89

+1

GIF和動畫GIF僅在週年紀念更新及以上版本中受支持。 –

回答

1

我不知道什麼是工作不適合你,但我迅速做了一個示範項目和GIF顯示的罰款。

MainPage.xaml中:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
     <Image Height="200" Width="200" Source="{x:Bind ImageSource, Mode=OneWay}"/> 
</Grid> 

MainPage.xaml.cs中

public sealed partial class MainPage : Page 
    { 
     private string ImageSource { get; set; } 
     public MainPage() 
     { 
      this.InitializeComponent(); 
      ImageSource = @"http://api.wunderground.com/api/9270a990901ad2ce/animatedradar/animatedsatellite/image.gif?num=5&delay=50&rad.maxlat=47.709&rad.maxlon=-69.263&rad.minlat=31.596&rad.minlon=-97.388&rad.width=640&rad.height=480&rad.rainsnow=1&rad.reproj.automerc=1&rad.num=5&sat.maxlat=47.709&sat.maxlon=-69.263&sat.minlat=31.596&sat.minlon=-97.388&sat.width=640&sat.height=480&sat.key=sat_ir4_bottom&sat.gtt=107&sat.proj=me&sat.timelabel=0&sat.num=5"; 
     } 
    } 
+0

你很可能會想'OneWay'模式添加到您的'X:Bind'也。 –

+0

單向或一次性無關緊要,除非您還添加了一個變化通知ImageSouce財產。 – Clemens

+0

謝謝!它的工作原理 另一個查詢:我想使用url 的BitmapImage I2 =新的BitmapImage(新的URI(「http://api.wunderground.com/api/9270a990901ad2ce/radar/image.gif?centerlat=38¢erlon=定義圖像-96.4&radius = 100&width = 280&height = 280&newmaps = 1「,UriKind.Absolute)); 我想要定義,並通過上述BitmapImage的語法修改插入我的自定義centerlat和centerlon,我試圖解析緯度和經度使用的String.Format一點不work.Thanks參數! –