<param name="SplashScreenSource" value="SplashScreen.xaml"/>
<param name="OnSourceDownloadProgressChanged" value="OnSourceDownloadProgressChanged" />
<param name="source" value="ClIEntBin/SilverlightAppTest.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?linkID=149156&v=4.0.50826.0" >
<img src="http://go.microsoft.com/fwlink/?linkID=161376" alt="获取 Microsoft Silverlight" />
</a>
</object>
在Silverlight加载时Object标签中新加入两个参数:
1.SplashScreenSource属性用于标记初始屏幕xaml页
2.OnSourceDownloadProgressChanged属性用于加载进度变化时的事件处理程序
程序如下:
SplashScreenSource.xaml:
<GrID x:name="LayoutRoot" Background="White">
<StackPanel HorizontalAlignment="Center">
<GrID HorizontalAlignment="Center">
<Rectangle stroke="#FFDEE6F0" HorizontalAlignment="left" WIDth="300"
Height="10" RadiusX="2" RadiusY="2" strokeThickness="1"/>
<Rectangle Fill="#FF7E99C8" HorizontalAlignment="left" VerticalAlignment="Center"
strokeThickness="0" RadiusX="0" RadiusY="0" WIDth="296" Height="6" x:name="progressbar"
RendertransformOrigin="0,0.5" margin="4">
<Rectangle.Rendertransform>
<Scaletransform x:name="progressbarScale" />
</Rectangle.Rendertransform>
</Rectangle>
</GrID>
<GrID HorizontalAlignment="Center">
<TextBlock x:name="progresstext" margin="18,17,19" Height="26" Text="0%"
FontSize="16" Opacity="0.8" VerticalAlignment="Bottom" TextAlignment="Right"/>
<TextBlock x:name="progresstext2" margin="18,7,8" Height="70" Text="0%"
FontSize="50" Opacity="0.04" FontWeight="Bold" VerticalAlignment="Bottom" TextAlignment="Right"/>
</GrID>
</StackPanel>
</GrID>
OnSourceDownloadProgressChanged
function OnSourceDownloadProgressChanged(sender,args) {
sender.findname("progresstext").Text = Math.round(eventArgs.progress * 100) + "%";
sender.findname("progresstext2").Text = Math.round(eventArgs.progress * 100) + "%";
sender.findname("progressbarScale").ScaleX = eventArgs.progress;
}
这样就自定义了一个非托管代码的初始化进度条显示.
总结以上是内存溢出为你收集整理的SilverLight-非托管代码初始化进度条显示方法全部内容,希望文章能够帮你解决SilverLight-非托管代码初始化进度条显示方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)