Keith Adler
Keith Adler

Reputation: 21178

Load screen image sometimes doesn't display

I have a custom splashscreen in my Silverlight 4 project which sometimes does not display the image element. If there something I need to do in order to ensure this image is displayed every time when the load screen is used?

<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" VerticalAlignment="Center" Margin="0,100,0,0">
    <Image Source="../Assets/Logo.png" 
       Height="200" Width="200"          
       HorizontalAlignment="Center"  VerticalAlignment="Center"          
       Margin="15" />
    <Grid HorizontalAlignment="Center">
        <Rectangle Name="rectBorder" StrokeThickness="1" Stroke="#FFC8C8C8" 
              Height="7" Width="200" HorizontalAlignment="Left"/>
        <Rectangle Name="rectBar" Fill="#FFC8C8C8" 
              Height="7" Width="0" HorizontalAlignment="Left" />
    </Grid>
</StackPanel>

Upvotes: 0

Views: 1784

Answers (1)

Laith
Laith

Reputation: 6091

When you load the silverlight object, the browser is told to download your XAP file, the XAML splash file, and then the Logo.png. This PNG is loaded last in the queue.

To fix that, try preloading an invisible image before embedding the tag.

<body>

  <img src="../Assets/Logo.png" style="width:0;height:0;" />

  <object>
  ... // your xap stuff goes here
  </object>

</body>

Upvotes: 4

Related Questions