views:

81

answers:

2

In Silverlight 4 application there are few images, both are displayed correctly in design mode, one is displayed correctly in run-time also:

<Image Height="180" Width="149" Source="../Picts/Field.png" />

Another one is not displayed in run-time:

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5" Visibility="{Binding SquadSavedVisibility, Mode=OneWay}">
    <Image Source="..\Picts\ok.png" Width="16" Height="16" />
    <TextBlock Text=" It is saved" Foreground="Green"/>
</StackPanel>

Why? And how to get it displayed?

Any thoughts are welcome. Thanks.

+4  A: 

It's all in your slashes, VS Design time doesn't mind you using "..\Picts\ok.png", but Silverlight runtime wants to see "../Picts/ok.png". In other words, your slashes matter.

Evan Hutnick
+1  A: 

You can try to hook into the Image.ImageFailed Event. For examples and more explanation you look into this page:
http://msdn.microsoft.com/en-us/library/system.windows.controls.image.imagefailed%28v=VS.95%29.aspx

Wouter Janssens - Xelos bvba