您的位置:首页 > Web前端 > JavaScript

稳扎稳打Silverlight(30) - 2.0Tip/Trick之Silverlight.js, Silverlight.supportedUserAgent.js, 自定义启动界面, 响应鼠标滚轮事件

2009-05-18 09:03 791 查看
[索引页]

[源码下载]

[align=center]稳扎稳打Silverlight(30) - 2.0Tip/Trick之Silverlight.js, Silverlight.supportedUserAgent.js, 自定义启动界面, 响应鼠标滚轮事件[/align]

作者:webabcd

介绍

Silverlight 2.0 提示和技巧系列

Silverlight.js - 一些 js 帮助函数,用于嵌为入 Silverlight 插件以及自定义安装体验等提供帮助

Silverlight.supportedUserAgent.js - 就一个函数,用于判断 Silverlight 是否支持用户的浏览器

自定义启动界面 - 三个参数的综合应用:splashScreenSource, onSourceDownloadProgressChanged, onSourceDownloadComplete

响应鼠标滚轮事件 - 响应并处理鼠标的滚轮事件

在线DEMO

/article/4589581.html

示例

1、Silverlight.js 和 Silverlight.supportedUserAgent.js 的常用函数的演示和说明

SilverlightDotJsDemo.html

<!--

详解 Silverlight.js

Silverlight.js - 一些 js 帮助函数,用于嵌为入 Silverlight 插件以及自定义安装体验等提供帮助,其最新版本在如下地址下载
http://code.msdn.microsoft.com/silverlightjs
Silverlight.supportedUserAgent.js - 就一个函数,用于判断 Silverlight 是否支持用户的浏览器,其最新版本在如下地址下载
http://code.msdn.microsoft.com/SLsupportedUA
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Silverlight.js</title>

<script type="text/javascript" src="../Silverlight.js"></script>

<script src="../Silverlight.supportedUserAgent.js" type="text/javascript"></script>

</head>

<body>

<div id="container">

<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">

<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"

style="border-style: none" />

</a>

</div>

</body>

</html>

2、自定义 Silverlight 程序的启动界面,并显示加载进度

启动界面的 xaml 文件

SplashScreen.xaml

<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Background="Bisque"

>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">

<TextBlock Text="Loading" Margin="3" />

<TextBlock x:Name="percent" Text="0%" Margin="3" />

</StackPanel>

</Grid>

Silverlight 程序全部加载完成前,显示启动界面并显示加载进度

SplashScreen.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>SplashScreen</title>

</head>

<body>

<div id="silverlightControlHost">

<object id="xaml1" data="data:application/x-silverlight-2," type="application/x-silverlight-2"

width="100%" height="100%">

<param name="source" value="../ClientBin/Silverlight20.xap" />

<!--下载 source 指定的 xap 的过程中所显示的 xaml 的地址-->

<param name="splashScreenSource" value="SplashScreen.xaml" />

<!--下载 source 指定的 xap 的过程中所持续调用的事件-->

<param name="onSourceDownloadProgressChanged" value="onSourceDownloadProgressChanged" />

<!--souce 指定的 xap 被完全下载后所触发的事件-->

<param name="onSourceDownloadComplete" value="onSourceDownloadComplete" />

</object>

<iframe style='visibility: hidden; height: 0; width: 0; border: 0px'></iframe>

</div>

</body>

</html>

3、响应并处理鼠标的滚轮事件

Wheel.xaml

<UserControl x:Class="Silverlight20.Tip.Wheel"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<StackPanel>

<TextBox x:Name="lblMsg" />

</StackPanel>

</UserControl>

Wheel.xaml.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using System.Windows.Browser;

namespace Silverlight20.Tip

OK

[源码下载]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐