这就是我在 Silverlight 中设置图像的方式:
Public Sub setImage(ByRef img As Image, ByVal nameWithExtension As String, ByVal uriKind As UriKind)
If uriKind = System.UriKind.Relative Then
img.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/PortalSilver;component/Images/" & nameWithExtension, uriKind))
Else
img.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri(nameWithExtension, uriKind))
End If
End Sub
我几乎总是使用绝对 URI。