xaml代码行:
1.<Canvas 2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4. x:Name="parentCanvas" 5. Width="1262" Height="613" Background="Black" 6. > 7. <Canvas.Triggers> 8. <EventTrigger RoutedEvent="Canvas.Loaded"> 9. <BeginStoryboard> 10. 11. <Storyboard x:Name="CycleAnimation" RepeatBehavior="Forever"> 12. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="snake" Storyboard.TargetProperty="Angle"> 13. <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"></SplineDoubleKeyFrame> 14. <SplineDoubleKeyFrame KeyTime="00:00:02" Value="10"></SplineDoubleKeyFrame> 15. <SplineDoubleKeyFrame KeyTime="00:00:04" Value="0"></SplineDoubleKeyFrame> 16. <SplineDoubleKeyFrame KeyTime="00:00:06" Value="-10"></SplineDoubleKeyFrame> 17. <SplineDoubleKeyFrame KeyTime="00:00:08" Value="0"></SplineDoubleKeyFrame> 18. </DoubleAnimationUsingKeyFrames> 19. </Storyboard> 20. </BeginStoryboard> 21. </EventTrigger> 22. </Canvas.Triggers> 23. <Grid Width="1262" Height="613"> 24. <Grid Width="120" Height="98" VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0" x:Name="pb1"> 25. <Grid.Background> 26. <ImageBrush ImageSource="/loading/ss.png"></ImageBrush> 27. </Grid.Background> 28. <Grid.RenderTransform> 29. <TransformGroup> 30. <ScaleTransform/> 31. <SkewTransform/> 32. <RotateTransform Angle="0" x:Name="snake"/> 33. <TranslateTransform/> 34. </TransformGroup> 35. </Grid.RenderTransform> 36. <TextBlock x:Name="txtLoad" Text="0%" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Margin="0 30 0 0" Foreground="White"></TextBlock> 37. </Grid> 38. </Grid> 39.</Canvas>
js代码行:
在aspx引用silverlight的object中加入
<param name="splashscreensource" value="Loading/CustomLoadPage.xaml"/> <param name="onSourceDownloadProgressChanged" value="onSourceDownloadProgressChanged" />
并引用上面的js文件
js文件的主要作用是显示载入的百分比.
silverlight的初始化屏幕.微软说明地址:http://msdn.microsoft.com/zh-cn/library/cc838130(VS.95).aspx
关于循环动画的事件触发器:http://msdn.microsoft.com/zh-cn/library/bb979699(VS.95).aspx
<EventTrigger RoutedEvent="Canvas.Loaded">的意思就是当这个画布被加载后.所执行的事件.
这样就可以在这个中间写入我们需要显示的效果.不需要用js来调用storybroder的启动.