开发者

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>


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>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜