开发者

Silveright image source on web not showing anything

I'm sure that this is a simple newbie question, but the answer is eluding me right now.

I have the following control compiled in Silverlight 3:

<UserControl x:Class="SLImageTest.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:DesignWidth="640" d:DesignHeight="480">
  <StackPanel>
        <Image Source="http://farm3.static.flickr.com/2733/4102919659_0207842bde_m.jpg" />
    </StackPanel>
</UserControl>

The image source isn't important, but you can verify that

  • there is a picture of a kitten at that URL
  • there a CrossDomain access file at http://farm3.static.flickr.com/crossdomain.xml

When I run the control, I don't get an image shown. So something is set up wrong despite my efforts. What has gone wrong?

But there is no debug output as there should be on a binding error, no exception thrown, no indication given of anything at all f开发者_开发技巧ailing! Why is that?

Code much like this works fine in WPF.

If I include the image into the project, and do

<Image Source="kitten1.jpg" />

That works fine. But it's not what I want.


My guess is that you're running it from a file:// URL and not an http:// URL. Look at the URL in the browser address bar to determine if this is true. That is a cross protocol access issue. The simple solution is to try it from the built-it web server in Visual Studio or Expression Blend. Debug your application from Visual Studio or run it from Blend and you'll see it has an http://localhost URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜