silverlihgt自定义启动画面

1..web工程下添加Silverlight JScript Page,名为"MySplashScreen"

2.

<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SL_Test.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" />
<param name="autoUpgrade" value="true" />
<!--以下三个参数为手动添加的 -->
<param name="splashscreensource" value="SplashScreen.xaml" />
<param name="onSourceDownloadProgressChanged" value="onSourceDownloadProgressChanged" />
<param name="onsourcedownloadcomplete" value="onsourcedownloadcomplete" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>

3.MySplashScreen.js中添加代码

function onSourceDownloadProgressChanged(sender, eventArgs) {
//添加下载进度改变时的代码    
}

function onsourcedownloadcomplete(sender, eventArgs) {
//添加下载完成时的代码    
} 

完成,在silverligh中添加一个大的文件,属性设为content来延长下载时间来测试启动画面

注:第一步也可以不在web工程下添加Silverlight JScript Page,而只是添加一个xmal文件作为启动画面的前台显示,其余与以上方法相同。

posted @ 2010-05-13 15:11  LARSON _  Views(247)  Comments(0Edit  收藏  举报