带远程路径的WPF图像

时间:2012-04-16 22:56:02

标签: c# wpf

我正在尝试将图像加载到我的Silverlight项目中,并且我有以下XAML:

<UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">
        <Image Height="150" Width="200" Source="http://wsf.cdyne.com/WeatherWS/Images/rain.gif" />
    </Grid>
</UserControl>

1 个答案:

答案 0 :(得分:1)

Silverlight中的Image控件仅支持PNG和JPEG,而不支持GIF。

http://msdn.microsoft.com/en-us/library/system.windows.controls.image(VS.95).aspx