微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

最好的通用式silverlight载入界面

1)在Silverlight.js文件增加以下代码

function onSourceDownloadProgressChanged(sender,eventArgs) {

    sender.findName("progresstext").Text = Math.round(eventArgs.progress * 100) + "%";
    sender.findName("progresstext2").Text = Math.round(eventArgs.progress * 100) + "%";
    sender.findName("progressBarScale").ScaleX = eventArgs.progress;
}

 

2)在需要使用该载入页面的HTML中,OBJECT中增加

  <param name="splashscreensource" value="SplashScreen.xaml"/>    
  <param name="onSourceDownloadProgressChanged" value="onSourceDownloadProgressChanged" />

 

3)在web根目录下,增加文件SplashScreen.xaml(注意,不是在每个xmal中)注意:其中的图片需要放在clientbin根目录下:


        <StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             VerticalAlignment="Center" Margin="0,100,0">

            <!--头部图片-->

            <Image x:Name="myImage" Source="SMS.png"
                   Height="56"
                    Width="240"
                    HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   Margin="10" Stretch="Uniform" />

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

        </StackPanel>如此,可以实现该网站下所有的silverlight载入统一的定制

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐