Welcome to MSDN Blogs Sign in | Join | Help

你的网站已经为 Internet Explorer 8 做好准备了吗?

来源: 开心就好 | 博客堂

在奥运会期间, IE 8 Beta 2将会发布,而且随着英文版的发布,中文版也会在第一波当中进行发布。
IE 8将会是Internet Explorer历史上最重要的一个版本发布,除了其带有中国传统的吉祥数字“8”以外,最主要的是其对标准的兼容性上得到了极高的增强,这对于网页开发人员来说,最大的便利就是不用再为每种浏览器(甚至某种浏览器的不同版本)开发不同的CSS来进行适应。以后网页开发人员只需要兼容W3C的标准即可,而不需要把过度的精力放在不同浏览器标准的相异性上。发布时间在即,那么您的网站是否已经准备好了呢?

1) 兼容性考虑

目前的网站由于各种历史原因,可能针对不同的浏览器设置了不同的CSS文件。而针对IE 8,可能大部分网站尚没有做好准备。可能很多朋友知道,IE 8带有一个“切换IE 7模仿模式”的按钮,而且在Beta 1以及Beta 2期间,这个按钮是设置在默认选中状态。但是在IE 8正式发布的时候,该按钮默认将会是非选中状态,这就表示着如果一个网站没有做任何准备功课,在IE 8下将会以严格模式来常解析CSS。

前段时间,我与合作伙伴见面时,曾经特意使用IE 8 Beta 2的严格模式浏览过大部分合作伙伴的网页,都会出现或多或少的显示变形的问题,使得网站无法进行正确浏览。如果您的网站尚未做过IE 8的兼容性测试,建议您尽快下载IE 8的Beta 1,并且将其切换到IE 8严格模式,对您的网站进行浏览。

如果您发现问题,并且感觉在短期内无法修复,您也可以通过在页面当中添加Meta标签,在服务器端强制IE 8使用“IE 7模仿模式”,做法很简单:

a.  针对全站页面:  您可以修改Web服务器(如Apache/IIS/Resin等)的HTTP头信息,在其中增加以下指令: X-UA-Compatible: IE=EmulateIE7。这个是我个人强烈推荐的做法,在您无法进行全站测试的情况下,可以先使用此方式使IE 8的严格模式暂时失效。

b. 针对单独页面:如果您的网站大部分页面在IE 8严格模式下显示正常,只有个别页面出现问题,建议在出现问题的页面的页首,即Head标签内添加以下Meta标签:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />。
更多信息,请参考: http://support.microsoft.com/kb/952030/

2) 制作Activity以及WebSlice

IE 8在Beta 1期间曝光了两个新特性,即Activity(活动)以及WebSlice(源剪辑),目前国内很多网站已经基于Activity以及WebSlice制作了相关的内容,在IE 8 Beta 2期间,您会发现更多的网站会发布这些实用的小工具。以下是目前已经对外发布的一些网站:

a. 淘宝:http://ie8.taobao.com

b. 网易:http://ie8.163.com

c. 百度:http://stock.baidu.com/ie8/ie8.html

d. 腾讯:http://labs.qq.com/e/49/

甚至包括.NET开发人员常去的博客园也已经发布了其最新文章的Web Slice,有兴趣的话可以使用IE 8 Beta 1来访问博客园的首页。另外,如果您也使用Firefox 3,您可以发现已经有人开发了面向Firefox 3的Activity以及WebSlice插件。

Activity的使用场景:您的网站提供一系列的服务,允许贵网站的用户通过在其它网站的主动操作来调用此服务。比如假设您是一个财经网站,提供查询股票/基金信息的服务,通过Activity,您可以让您的用户在其它网站上浏览股评信息时,不需要跳转到贵网站,即可以通过右键菜单调用贵网站的相应服务。如果感兴趣,可以下载Activity开发白皮书

WebSlice的使用场景:您的网站提供一些实时性信息,比如新闻、股票信息等,而希望用户可以在不返回相应页面的时候,当内容发生改动时,即可以推送给最终用户,您可以选择WebSlice。而开发代价仅仅只是将页面当中的某一个标签内的“Class”元素设置为“hslice”这个特殊名称即可,详细信息请阅读WebSlice开发白皮书
另外,在IE 8 Beta 2发布时,微软将会发布一个面向IE 8全新的Gallery网站,用以搜索各个网站开发的WebSlice/Activity等面向IE 8新特性的组件,并且提供最终用户评估/下载,如果您希望您开发的WebSlices/Activity能够得到用户的青睐,那么就从现在开始吧:早起的鸟儿有虫吃。 :)

3) 其它

IE 8 Beta 2发布时,还将会带来一系列的新特性,在前段时期,已经面向国内一些领先的网站进行过交流,很多合作伙伴都非常感兴趣,并且正在开发此上的服务,相信在奥运会期间大家会看到此类的成果(依据NDA协议,此类网站也已经从微软拿到了IE 8 Beta 2的早期内部版本)。微软也将会举办一系列的市场活动,用以推广我们的合作伙伴所开发的各种面向IE 8的新的服务。

IE 8 Beta 2即将发布,无论您是企业网站的网页设计人员,还是个人网站的站长,都需要尽快为IE 8做好准备。 希望本文对您有帮助。

Posted by Felix Wang | 1 Comments
Filed under: , , , ,

On10: Silverlight on Windows Mobile with John L Scott Real Estate

[On10]Recently, I conducted an interview with Lennox Scott, Chairman and CEO of John L Scott Real Estate.  With the help of Dr. Neil Roodyn, Tricky Business, and Loke Uei Tan from the Windows Mobile team, John L Scott Real Estate agreed to build a Silverlight POC targeting the Windows Mobile platform.

Read

Posted by Felix Wang | 1 Comments
Filed under: , ,

3rd party Silverlight controls

ComponentOne
A full suite of components including custom layout panels, menus, treeview, textboxes, charts and more.

DevExpress
A free datagrid with grouping, sorting, resizing, template support, multi-row selection and more.

Infragistics
A large collection of charts and gauges for data visualization.

Intersoft
Two alternative controls to the standard menu, FishEye and CoverFlow.

NETiKA Tech
An implementation of the standard Windows Forms control library, developed as Windows Forms Applications and run as Silverlight applications.

Telerik
A full suite of components including menus, tabcontrols, treeviews, mediaplayer, progressbar and more.

Visifire
A large collection of open source data visualization components.

Xceed
An asynchronous, multiple file upload control with data compression.

Posted by Felix Wang | 0 Comments
Filed under:

Changes in the new DeepZoom Composer

[Via] Along with the Silverlight 2 Beta 2 a new version of the DeepZoom Composer was also released. After taking a look at it, I thought that it might be useful to make a list with the changes and the new features I found in it.

  • Output format changed to XML file
  • Image tags can now be added in the Compose section
  • Alignment to Grid and guidelines added to the Compose section
  • Export section enhancements (image formats, Silverlight project output)

Note! I assume that you already know what the DeepZoom Composer is and how to use it. If not please take a look at this article first and then go back to see what are the changes in this version.

Mechanics

The first thing you probably should know about the new DeepZoom Composer is that the output format is changed. Instead of binary file the output is an XML file. The maximum tile size is changed from 512x512 pixels to 256x256 pixels.

Compose

A new panel is added under the imported images list. It contains information about the selected image – size, path and tag. Tag is used to provide additional information for the image and is used only along with the SubImages collection in the MultiscaleImage control. The tags are saved together with the other image information in an XML file, which can later be parsed using Silverlight and LINQ.

After I played a while with the composer I found that when you drag an image into the scene and try to align it with another image on the scene a guideline appears like in the example:

There is also a possibility to arrange the composed images into a grid. This option can be found in the context menu.

Then you will be able to constrain the grid by columns or rows, set their number and the padding between the images.

Looking at this options you can guess that the Grid can only contains rows or columns, although it’s possible to have more than one image in a row. For example if we have 4 images, Constrain by rows and 2 rows the result is the following:

Something interesting here: A Grid, constrained by columns, with n pictures and one column is the same as a Grid, constrained by Rows, with n pictures and n rows.

Export

In the export section there are pretty good changes. First you can choose between Composition and Collection. You can also choose the image format (PNG or JPEG) for the exported images. Selecting a JPEG allows you to set the quality of the images. And last but not least is the thing I find very useful – the output types. The first option is “Export Images”. That’s clearly the export behavior of the old DeepZoom Composer. The new thing here is the “Export Images and Silverlight Project” option. If selected, the DeepZoom Composer not only exports the composition, but creates a Silverlight project, that contains a MultiscaleImage control with complete zoom and pan functionality. The control’s source is the freshly created composition, so you can immediately take a look at your creation.

If you are interested how to use the MultiscaleImage control with the outputted files or how to implement such functionality to it, take a look at this article.

Sysinternals Utilities on a Share Folder: \\live.sysinternals.com\tools\

If you're a fan of the Sysinternals tools, check out the beta of Sysinternals Live, a service that makes it easy for you to execute Sysinternals tools directly from the Web without hunting for and manually downloading them. Simply enter a tool’s Sysinternals Live path into Windows Explorer, or at the command prompt as \\live.sysinternals.com\tools\<toolname>, or view the entire Sysinternals Live tools directory in a browser.

Posted by Felix Wang | 0 Comments

TechED2008: Sessions on Silverlight Controls Framework

via scorbs

WUX206: An Introduction to Microsoft Silverlight Controls Framework [slides | samples]

 

WUX326: Understanding the Microsoft Silverlight 2 Control Skinning Framework [slides | samples]

 

weather

WeatherControl sample app

Detailed Overview of Silverlight 2 Beta 2 Web Service Features

Src: Silverlight Web Services Team

 

Duplex Communication (Server Push)

This has been the most requested feature from our customers since the release of Beta 1, and it enables some useful scenarios like building chat and monitoring apps. Duplex allows the client to expose a set of operations that the server can call to send (push) information to the client. Previously addressing the browser-based client was not possible using the web service stack, so we are very excited to ship this feature in Beta 2.

Duplex support is delivered in two assemblies: one that plugs into your WCF service, and the other one which plugs in to the Silverlight client. Once you install the Beta 2 SDK, you will get the following assemblies:

  • C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\Evaluation\System.ServiceModel.PollingDuplex.dll
    This is the server-side assembly. For details on it usage and how to build a duplex WCF service, see this topic in the documentation. The assembly provides you with the server-side PollingDuplexBindingElement, which allows you to build a custom binding, You can then build a custom ServiceHost, which uses the custom binding to host your service contract. A service contract hosted this way will support ServiceContractAttribute.CallbackContract, which is how you specify the client operations that the service can call. The topic referenced above goes through all these details and shows you a finished duplex WCF service.
    You may have noticed the "Evaluation" folder name in the path. This assembly is provided on a different license than the rest of the Beta 2 product, and is not meant for production apps. We intend to put some more work into the API and tune the performance before this component is ready for production environments.
  • C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client\System.ServiceModel.PollingDuplex.dll
    This is the client-side duplex assembly. For details on its usage and how to build a Silverilght client for a WCF duplex service, see this topic in the documentation. The assembly provides you with the client-side PollingDuplexHttpBinding, which can be used to create a channel to talk to the WCF duplex service. This is covered by the above topic.

You might remember Eugene's blog post, which talks about a typed "receiver" experience, which also takes care of deserialization. We are working on this and will likely release it as a code sample on silverlight.net in the coming weeks.

LINQ over JSON

Many web services provide APIs which return JSON data instead of POX or SOAP, and we want to make sure Silverlight provides great support for these types of services. So far the only way to interact with JSON in Silverlight has been to deserialize it into a type, which we have defined already to match the structure of the JSON. However this becomes impractical for APIs that return a lot of JSON data. Take Facebook for example: just asking for a user's information returns almost a page of JSON, and it would be impractical for a Silverilght developer to have to construct a type to match this JSON, especially if the Silverlight app is a mashup and interacts with multiple complex JSON APIs. In situations like this, we would prefer to "dot into" the JSON object and treat it as more of a dictionary, as opposed through the deserialization mechanism.

Beta 2 introduces a brand new feature called JsonObject, which is also new to the .Net platform. JsonObject allows you to "parse" a JSON string and then use it as a dictionary in Silverlight, as shown in this documentation topic. Using the following JSON string as an example,

[{"IsMember" : true, "Name" : "John", "Age" : 24},
{"IsMember" : false, "Name" : "Paul", "Age" : 44},
{"IsMember" : true, "Name" : "George", "Age" : 12}]

we can parse it into the JsonObject users, and then access its members this way: users[0]["Name"], users[1]["Age"], etc. We can then construct LINQ expressions such as

var members = from member in users
where member["IsMember"]
select member;

The FoodFinder sample on silverlight.net provides a real usage example of the Yahoo! Local JSON API (download the source code). The following LINQ query is used by the sample to dynamically filter the results returned by the service based on two sliders that the user controls.

var members = from restaurant in (JsonArray)results["ResultSet"]["Result"]
where float.Parse(restaurant["Rating"]["AverageRating"]) >= rating.Value
              where float.Parse(restaurant["Distance"]) < distance.Value
select restaurant;

Configuration Support

In Beta 1, the binding and endpoint address had to be specified in code and passed as parameters to the proxy constructor.

BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress(http://localhost/service.svc);
ServiceClient proxy = new ServiceClient(binding, address);

In Beta 2 the "Add Service Reference" feature in Visual Studio will generate a ServiceReference.clientConfig file, which will contain the binding and address configuration informaton, and the proxy can be constructed with its default constructor.

ServiceClient proxy = new ServiceClient();

This allows us to change the binding/address without needing to recompile the Silverlight control. In addition configuration exposes some knobs on the binding, which can be tweaked for security or performance reasons:

<binding name="BasicHttpBinding_IService" closeTimeout="00:59:00" openTimeout="00:53:00"
receiveTimeout="00:15:00" sendTimeout="00:21:00" maxBufferSize="65530"
maxReceivedMessageSize="65531" textEncoding="utf-8" />

This documentation topic explains the different settings available.

Tooling Improvements

We have added the "Silverlight-enalbled WCF Service" Item template. When a WCF service is added using this template, the binding in the service configuration is automatically switched to basicHttpBinding.

Silverlight-enabled WCF Service Item Template

IntelliSense over .clientConfig files is now supported. As you start editing the file you will get useful popups with the supported schema.

IntelliSense over .clientConfig

SOAP Improvements

We have made some general SOAP improvements in Beta 2:

  • Custom SOAP headers and faults in service - ignored and don't generate uncompilable code
  • “Wildcard” schema in service (like xsd:any or xsd:anyattribute) - now works and doesn't generate uncompilable code

And specifically if your service is a WCF (or in some cases .ASMX) service:

  • XML types like XmlElement/XElement/XmlNode[]/XmlAttribute/etc in service - now work and don't generate uncompilable code
  • Types that implement ISerializable in your service (except for collections) - now work and don't generate uncompilable code
  • Stream type in service - now works and doesn't generate uncompilable code
  • MessageHeaderAttribute in Message Contracts - ignored and doesn't generate uncompilable code
Posted by Felix Wang | 0 Comments
Filed under:

timheuer: Silverlight 2 Beta 2 updates for web services

We were all jumping for joy when Silverlight 2 beta 1 was released and the ability to connect to services was more readily/easily available to us.  For discoverable services that provided a WSDL we were quickly able to implement them using the Add Service Reference capability in Visual Studio 2008.  Beta 2 brings a few changes to the world of services that you should know about.  I’ll do my best to recap some of them here.

  • Generating a WCF Service
  • Cross-domain policy file updates
  • ServiceReferences.ClientConfig
  • Change to WebClient

Read

Posted by Felix Wang | 0 Comments
Filed under:

Silverlight 2 Beta2发布了

Source: scottgu | joycode

Silverlight 2 Beta2版今天发布了,你可以在这里下载Silverlight 2 Beta2以及Visual Studio和Expression Blend工具支持。

Beta2加了许许多多的新功能(下面有更多细节),但下载大小仍只有4.6MB大,在机器上安装所花时间少于10秒,不用安装.NET框架或其他任何软件就可以工作,所有的功能在Mac和Windows机器上都能跨浏览器工作,这些功能在Linux上将由Moonlight 2提供。

Silverlight 2 Beta2支持一个go-live许可,它允许你开始使用和部署Silverlight 2于商业应用中。在Beta2与最终版间,会有一些API变动,所以你应该预期你用Beta2编写的应用在最终版出来时需要做些更新。但我们认为这些变动将是直截了当和比较容易的,你现在可以开始计划和着手开发商业项目了。

你可以使用Silverlight之VS 2008工具和Expression Blend 2.5六月份预览版来开发Silverlight Beta2应用,你可以在这里下载这2个工具,Silverlight之VS 2008工具在VS 2008和最近发布的VS 2008 SP1 beta下都工作。

UI以及控件方面的改进

Silverlight 2 Beta2 包括了在UI和控件方面的一大堆工作:

更多的内置控件

Beta 1的核心Silverlight安装只包含了几个控件,最常用的控件(包括Button, ListBox, Slider等)都是在另外的程序集中发布的,你需要在应用中将这些程序集捆绑发布(其结果是增加了应用的下载大小)。 作为核心Silverlight 2下载的一部分,Beta 2 现在将安装30多个最常用的控件,这意味着你现在可以开发使用这些核心控件的Silverlight 2应用,其下载大小可以只有3kb那么大,- 使得Silverlight应用的下载大小很小,并使得应用启动极快。

除了包含在基本Silverlight 2安装中的核心控件外,这个星期我们还将发布在另外的程序集中实现的其他高层次的控件,你可以在应用中引用和包含它们。这包括象DataGrid(其Beta2的新特性见下面),日历(Beta2中有多日选择和不可选日期的支持),以及TabPanel(Beta2中才出现的新控件)这样的控件。

我们最终预计会发布100多个Silverlight控件。

控件模板编辑支持

WPF和Silverlight编程模型最强大的一个功能是其完全定制控件的观感的能力,这允许开发人员和设计师以微妙和戏剧性的方式对控件的UI进行精雕细琢,促成巨大的灵活性。我曾在这里的Silverlight控件模板博客贴子里对这些概念讨论过。

这个星期的Expression Blend 2.5六月份预览版现在对控件模板编辑加了设计器支持,将方便你快速地改变任何控件的外观,而不必再屈尊去修改XAML源码。

要看控件模板编辑的实战例子的话,在Expression Blend设计表面上拖放2个Slider控件:

我们也许会判定默认的Slider控件模板的滑块对我们的应用来说太大,太宽了。要用控件模板编辑功能来改变它的话,我们可以在设计器上右击其中一个slider,选择“编辑控件部件”上下文菜单项。我们可以给我们的Slider选择创建一个空白的控件模板(从头做起),也可以编辑内置控件模板的拷贝(然后对之细调):

在我们选择编辑现有的控件模板的拷贝之后,Blend会提示我们创建并命名一个可重用的样式资源,我们将在其中定义我们的控件模板。命名完之后,我们可以选择将样式保存在应用级(在App.xaml中)或在当前页面/用户控件中:

在点击OK之后,我们会发现转到了Slider控件的模板编辑模式之下,我们可以改变,细调,添加/去除Slider控件模板中的任何底层元素。注意下面,在模板编辑模式中,我们可以看到和选择组成Slider控件模板的任何底层元素(这些元素在下面的“Objects”窗口中用红笔圈了出来)。

想把滑块做得窄一点的话,我们可以选择控件模板中的“HorizontalThumb”元素,调整它的宽度(在界面里或通过属性网格):

然后,我们可以使用设计器顶部的breadcrumb导航条回到我们的页面,看控件模板的变动实施后的效果:

注意,目前只有一个Slider控件使用了刚定义的控件模板的新样式资源。

要把同样的样式资源用到另外一个Silder控件上,我们可以选择该控件,右击,然后使用“Apply Resource(应用资源)”上下文菜单,把“ScottSlider”样式用到该控件上:

之后,2个Slider将引用同个样式:

以后对“ScottSlider”样式做的任何改变将会自动应用到这2个控件之上。

注意,在Silverlight 2中发布的所有控件都支持控件模板,在Expression Blend中都支持上面那样的编辑体验。

Visual State Manager (VSM-视觉状态管理器) 之支持

Silverlight 和 WPF中的控件模板支持对控件的“look(外观)”,以及控件的“feel(感觉)”的定制。“feel”之谓,我指的是改变它交互的响应性。例如,在按下时,得到焦点时,失去焦点时,处于按下的状态时,处于不可用(disabled)状态时,内中有东西被选中时。。。,它是如何反应的。经常地,在用户象这样与控件做交互时,你要执行动画效果。

我们在Silverlight 2 Beta2中引进的一个新东西是"Visual State Manager(视觉状态管理器)" (VSM),该功能将极大地方便你建造交互性的控件模板。VSM引入了你可在控件模板中利用的2个基本概念:"视觉状态(Visual States)" 和 "状态迁移(State Transitions)"。例如,象按钮这样的控件为自己定义了多个视觉状态: "Normal(正常)", "MouseOver(鼠标之下)", "Pressed(按下)", "Disabled(不可用)", "Focused(获取焦点)", "Unfocused(不具焦点)"。在Blend中的模板编辑模式下,设计师现在可以轻松地编辑按钮在每个特定状态下的外观,以及设置迁移规则来控制从一个状态迁移到另一个状态时动画效果应该运行的时间。然后在运行时,Silverlight会动态地运行合适的动画故事板来把控件从一个状态平滑地过渡到另一个状态。

这个模型很棒的地方是,设计师用编写代码,用手工创建动画故事板,也用理解控件的对象模型就可以非常有效率。这使得学习创建交互性控件模板的曲线非常容易,意味着现有的美工可以轻松地参与Silverlight项目。今年稍后,我们还将往WPF中添加"Visual State Manager(视觉状态管理器)" (VSM)的支持,让你在Windows应用中使用同样的方法,以及在 WPF 和 Silverlight 项目间共享控件模板。

要看这个的实战例子,让我们往设计表面上加一个Button控件:

然后,我们可以右击按钮控件,编辑它的控件模板。我们将不从现有的默认控件模板开始(就象上面的Slider例子一样),让我们创建一个空白的控件模板,从头做起:

Blend会提示我们给要创建的样式(Style)资源取一个名字,我们将它取名为“ScottButton”,点击OK。这会把设计器置于按钮的控件编辑模式下,一开始只有一个空白的控件模板:

上面有一样需要注意的东西是,在Blend中有一个新的“States(状态)”窗口,这个窗口会显示Button控件提供的所有的“Visual States(视觉状态)”。在上面,当前被选中的是“Base(基底)”状态,该状态允许我们定义我们的按钮控件模板常用的视觉树。

然后,我们可以往我们的基底状态中加一些矢量元素,来定义象下面这样的定制按钮的外观。我们可以使用由Blend提供的内置矢量绘制工具支持来设计这些图形,或者使用Expression Design 或 Adobe Illustrator来建造矢量图形,然后将其导入Blend中。下面,我们在我们的控件模板中加了4个“Path”元素,一个是带圆角的背景(其名为“background”),另一个带阴影(drop shadow)(其名为“shadow”),还有一个是带40%蔽光性的“shine”(在顶部加了一些晕光),再有一个定义了默认的内部内容(在这个情形下,是个房子的图案):

注:我们也可以导入一个图片,但使用矢量元素会给予我们以后对按钮进行扩缩/转换,在任意分辨率或尺度上保持清晰观感的灵活性(特别是在Silverlight移动设备的场景下,屏幕的分辨率大不相同或较小时,尤其有用),还允许我们对美工设计中的任何矢量元素可以轻易地做动画效果或改动。

完成设计上面的基底状态之后,我们可以按F5在浏览器中运行应用:

你可以在上面看到,我们的按钮控件现在拥有一个比较好看的外观。尽管它有了一个新的外观,但按钮依然象以前那样触发同样的焦点,点击,和悬浮事件,所以,使用按钮的开发人员在操作使用了我们的新控件模板的按钮时,不用改动任何代码

但我们的新按钮控件模板的一个缺点是,它并不是交互的。这意味着,如果按钮获得/失去焦点,或者鼠标悬浮其上时,我得不到任何视觉反馈。点击时,我也得不到很好的按下/弹起的动画效果。

要将交互性加到我们的按钮上,我们将回到Blend中,再次操作我们按钮的控件模板。之前我们把矢量图形元素加到了我们按钮的“Base(基底)”状态中,这允许我们定义所有视觉状态的默认视觉外观。我们现在将回去,进一步定制个别的按钮视觉状态。

例如,为实现按钮的mouse-over行为,我们可以在“States”窗口中选择“MouseOver”状态,然后细调按钮处于该状态时的外观。在下面,我选了控件模板中的“shine”矢量元素,调整它在属性网格中的Opacity属性,使其在MouseOver状态下可见度更高。注意Blend是如何在对象窗口中,自动使用红点加亮“shine”元素,然后在该元素的下面列出了Opacity属性的。这可以便利很快地跟踪我们在控件模板中在“Base(基底)”状态和“MouseOver”状态间所做的所有变动:

然后,我们可以在“States”窗口中选择“Pressed”状态,定制按钮处于按下状态时的外观。我们将改变“Base(基底)”状态的2样东西,第一个变动是使得“shine”元素可见(就象MouseOver状态一样),第二个变动是稍微偏移按钮控件的内容,同时保持影子元素不动。这会给予按钮一个很好看的“depressed(按下)”外观,与它的基底视觉形成很好的反差:

我们可以这样来实现偏移变动: 在设计器中选择background,content和shine元素,然后在属性浏览器中对它们施加一个偏移显示转换(offset render transform):

现在,在浏览器中再次运行我们的应用的话,我们会发现我们的按钮在使用时有交互的视觉反馈了。下面是我们按钮的“Normal(正常)”外观:

将鼠标悬浮于按钮之上,会造成象下面这样的发光效果:

点击按钮会导致它按下去,隐藏影子(在松开鼠标按钮时,它会弹回来):

注意,我们用编写任何代码或XAML来改变我们按钮的观感,新的视觉状态管理器功能会自动地为我们处理视觉状态间的过渡。

在默认情形下,在你从一个视觉状态移动到另一个视觉状态时,Silverlight会动态地为你构建和运行过渡Storyboard(提供了2个状态间的平滑过渡动画效果),你需编写任何代码就可以让这一切发生(注:如果你想的话,你还是能降低层次(drop down),加一个定制的Storyboard过渡,但在大多数情形下,你大概可以使用自动的Storyboard过渡)。

Silverlight的自动过渡功能中你可以利用的一个特性是,定制视觉状态过渡发生所花的时间,你可以这么做,点击视觉状态右边的箭头,设置一个规则来控制当从一个特定状态移到另一个状态时,过渡动画效果应该运行的时间。

例如,我们可以加如下的规则来表示,我们要它花0.2秒钟的时间来从"Normal"过渡到"MouseOver"视觉状态:

然后,我们可以象这样来配置这个规则,在Normal->MouseOver间过渡时花0.2秒钟:

然后,我们可以点击"MouseOver"状态,设置一个规则,导致从MouseOver->Normal的过渡花0.4秒钟:

现在,当我们重新运行应用时,对MouseOver场景,我们将有一个慢了一点的动画过渡,给我们的应用添加了一种稍微更加平滑和更为精致的感觉。我们不用编写一行代码就可以促成这个效果。 随Silverlight 2发布的所有控件都有对象上面这样的控件模板和视觉状态管理器之定制的内置支持。

想进一步了解新的视觉状态管理器和控件模板编辑功能的话,请看一下 这里这里的教程, 以及这里, 这里这里的相关录像。

TextBox

Beta2包括了对内置的TextBox编辑控件的一些非常重大的改进,现在支持带换行的文本卷动,多行文字选择,文档导航键,以及从剪贴板的拷贝/粘贴等。

Beta2现在还包含了对非西方字符集的IME Level 3输入支持(包括候选窗口选择):

输入支持

Beta2添加了全屏模式下额外的键盘支持(箭头键,tab,回车,home,end,上一页/下一页,空格键)。注:为避免密码欺骗场景,目前尚不允许完整的键盘输入支持。

Beta2还加了新的APIs支持墨印和笔触输入。

UI自动化和可访问性(Accessibility)

Beta2在Silverlight中添加了UI自动化框架支持,UI自动化(简称为UIA)允许屏幕阅读器和其他辅助性工具识别组成你的Silverlight 2应用的组件并与之进行交互。

Beta2使用了UIA框架,对一套Silverlight控件加了基于UIA的行为。在Silverlight 2的最终版本中,所有的控件都将内置拥有基于UIA的行为。我们还将支持高对比度的场景。这些功能将允许你建造可访问的,兼容section 508的应用。这个UIA支持还将促成对应用的自动化UI测试。

动画和图形系统

Beta2加了对自定义依赖属性的动画支持,现在也支持对象动画支持(对结构体的动画效果)。Beta2还支持在代码中创建Storyboard来对部分显示树执行动画效果,而不用将Storyboard加到显示树中(允许你将动画效果完全嵌在代码中),每帧动画的回调支持将加在最终版中。

Beta2包含了一个新的视觉树静态辅助类,提供了高级的视觉树检视APIs。它提供了象这样的功能: 枚举某个元素的子元素,获取某个给定参考元素的祖先/父元素。这些APIs可以操作你传人的任何UIElement对象。

DeepZoom

Beta2现在支持基于XML的DeepZoom集合的Manifest文件,Beta2还对DeepZoom加了可扩展的MultiScaleTileSource支持(允许开发人员连接到与Deep Zoom高性能显示所用格式不相符的的现有的金字塔结构的图片集合上)。

WPF兼容性

Silverlight Beta2包含了许多许多的缺陷修补/改动,以改进Silverlight和WPF间的API兼容性(注:Silverlight的最终版还将包含一些额外的兼容性工作)。我们还将在今夏把在 Silverlight 2中引进的一些新APIs加到.NET 3.5 SP1中的WPF中。

这个工作,加上我们今年稍后将加到WPF的VSM支持,将促成浏览器和桌面应用间很好的代码重用。

多媒体方面的改进

Silverlight 2 Beta2 包含了一些重大的媒体方面的工作:

自适应流媒体传输(Adaptive Streaming)

Beta2加了对“自适应流媒体传输(adaptive streaming)”的支持,它允许你以多种比特率编码媒体,然后由Silverlight应用根据网络和CPU条件动态地在它们中间切换。

这将促成极其丰富的终端用户媒体体验,因为它造成了这样的可能性,由内容提供商同时提供低端和高端比特率版本的录像,而由Silverlight根据终端用户的机器硬件和网络容量选择使用最佳的版本。假如在观看录像期间,机器或网络条件改变的话, Silverlight 可以自动地切换到更合适的比特率,而不用任何缓存或造成中断性故障。

Silverlight对自适应流媒体传输(Adaptive Streaming)的支持是可扩展的,允许任何人接入他们自己的逻辑来控制媒体内容的来源,应该使用什么比特率等。这意味着,任何CDN(内容发送网络)或媒体交付供应商可以轻松地与Silverlight集成,发送超高质量的录像。

内容保护

Beta2包含了DRM内容保护,支持Windows DRM和PlayReady DRM,两者都能跨浏览器和跨平台工作。

服务器端的播放列表

Beta2加了对服务器端播放列表的支持(以前的版本只支持客户端播放列表)。

Networking方面的改进

Silverlight 2 Beta2包含了一堆networking方面的工作:

跨域Sockets

Beta2现在允许跨域的HTTP和Sockets的networking支持(意味着你的应用可以调用不同于当前应用下载自的站点的网站)。

Silverlight会查看目标服务器上是否存在这样的XML策略文件,这文件表明了是否允许跨域网络访问。Silverlight支持一个我们开发的新XML策略文件格式,以及Flash策略文件(意味着可为Flash所用的现有的网站,不用费额外的功夫,就可在Silverlight中调用)。

后台线程Networking

Beta2现在允许Silverlight应用在后台线程上开始网络请求,以及在后台线程上处理网络回复。这将促成一大堆非常强有力的场景,允许你在做HTTP和Socket网络通讯时,避免阻塞浏览器的UI线程。

双向通讯(服务器推送)

Beta2支持与服务器上的WCF服务建立双向信道(duplex communication channels),这将促成一个非常干净的编程模型,允许服务器将消息“推送”到Silverlight客户端,而不用开发人员手工轮询服务器端的变动。这个编程模型在多种场景中都非常有用,包括即时消息/聊天应用,象股票行情和交易这样的监测/更新应用等。

Web服务

Beta2还显著改进了与基于SOAP的web服务间的互操作,Web服务代理类端点URL现在不用重新编译应用就可配置。Visual Studio现在还有一个新的“Silverlight-enabled WCF Service(启用了Silvelight的WCF服务)”项目模板,你可以将其加到ASP.NET web项目中,将服务发布到客户端。

REST和ADO.NET数据服务

Silverlight包括了对操作基于REST的web服务的支持。

Beta2加了对调用和消费ADO.NET Data Services(以前的代号为“Astoria”)的支持,ADO.NET Data Services将作为.NET 3.5 SP1的一部分发布,将便利在 ASP.NET web项目中发布可为任何使用REST URIs的客户端所消费的数据端点。 Silverlight Beta2 现在包括了 ADO.NET Data Service 客户端支持,这些支持允许你轻松地调用这些服务(还可以在Silverlight中使用LINQ表达式来表示这些服务的远程REST查询)。

JSON

Silverlight支持调用网上的基于JSON的服务。

Beta2现在还包括了LINQ to JSON支持,允许你在Silverlight应用中轻松地查询,过滤,并将JSON结果映射到.NET对象上,这方便了对已经发布在网上的现有的AJAX端点和服务的调用和操作。

数据方面的改进

Silverlight 2 Beta2 包括了数据方面的一堆工作:

DataGrid

Beta2给DataGrid控件加了若干个新功能,这些功能包括:

  • 行与列的高宽自动调整(Auto-sizing)支持
  • 按列排序(单列和多列排序支持)
  • 对终端用户重排纵列顺序(Column re-ordering)的支持(允许他们拖放纵列来重新安排顺序)
  • 固定列(Frozen column)的支持(允许你防止某个特定列的定制)
  • 性能和缺陷修补

数据绑定

Beta2加了更多核心的数据绑定功能以及更好的验证支持,这些包括:

  • 控件上每个绑定的Validation和BindingValidationError事件处理支持(允许你用TwoWay绑定来处理输入验证)
  • 对附加属性(attached properties)绑定表达式的支持
  • 更丰富的绑定值转换支持(包括值转换后备支持(fallback support))

隔离储存(Isolated Storage)

Silverlight允许应用将数据保存在客户端(通过我们称之为“Isolated Storage”的特性),应用可以提示用户授予它们改变该储存大小的权限(例如,一个用户也许会准许一个email程序50MB的本地存储)。

Beta2将提供给Silverlight应用的默认本地存储空间的大小增加到了1MB, Beta2现在还对管理每个网站的存储权限提供了更好的终端用户支持,以及轻松取消/删除应用的本地存储的能力。控制这些的管理UI现在可以由终端用户右击Silverlight应用,选择“Silverlight Configuration(配置)”菜单选项来调出来。

理解与Silverlight 1.0和Silverlight 2 Beta 1间的兼容性

Silverlight 2 Beta2与针对Silverlight 1.0的应用是兼容的。

Silverlight 2 Beta2 运行不了针对 Silverlight 2 Beta1 的应用, 因为,为了加入Silverlight 2的新功能,我们在两个beta版本间做了若干个API变动。安装了Silverlight 2 Beta1的浏览器在访问宿主了Silverlight Beta2应用的网站时,会提示升级到新的Silverlight beta版本。升级之后,不卸载Beta2的话,是无法再运行Beta1应用了。这意味着,如果你已经在网上发布了用Beta1开发的应用的话,你大概要尽快将其升级到Beta2。

我们在这里发表了一个文档,详细说明了Beta1和Beta2间的变动,可以帮助你理解这个情形。我还推荐你阅读 Shawn Wildermuth的《What Changed in Silverlight 2 Beta2(Silverlight 2 Beta2中的变动)》 和 《Upgrading your Silverlight 2 Projects to Beta2(将你的Silverlight 2应用升级到Beta2)》贴子,以了解Beta1和Beta2间的一些变动的更多细节。

结语

想了解 Silverlight 2的详细情况,下载Beta2的话,请访问http://www.silverlight.nethttp://expression.microsoft.com网站,我们会在不久的将来在这2个网站上发布文章,教程,录像以及其他信息,我也会在博客上发表一些我自己撰写的教程。

如果你还没读过的话,我建议你读一下几个月前Beta1发布时我写的《Silverlight 2初览》 和 《使用Expression Blend开发Silverlight 2应用 -- 初览 》贴子,它们对Silverlight编程模型和如何使用Visual Studio 2008和Expression Blend开发针对应用提供了很好的概述。

希望本文对你有所帮助,

Scott

WF/WCF Influencer MSDN Webcasts in June

We are launching a series of MSDN webcasts to explore the possibilities of Microsoft .NET 3.5 Framework through demonstrations and deep dives on Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF).   In these series, you will learn from the industry experts on how to build WF/WCF applications.

You can find links to our June MSDN Webcasts here:  http://www.microsoft.com/events/series/msdnnetframework35.aspx?tab=webcasts&id=liveall

Webcast Title Date/ Time Presenter
Beyond the Endpoints with Windows Communication Foundation 6/18/2008 10:00 AM Juval Lowy
geekSpeak: Workflow Services in .NET 3.5 with Jon Flanders 6/18/2008 12:00 PM Jon Flanders
Calling Services from Silverlight 2.0 6/23/2008 09:00 AM Jon Flanders
Windows Communication Foundation and Windows Workflow Foundation Integration in Depth 6/25/2008 10:00 AM Jesus Rodriguez
Windows Workflow Communication in Depth 6/26/2008 09:00 AM Matt Milner

We’ll update the site in the next weeks with more information on our upcoming influencer webcasts for the month of July.

Posted by Felix Wang | 0 Comments

Silverlight 2 Beta 2 Release

At TechEd2008, Soma Somasegar and Bill Gates will announced that Silverlight 2 Beta 2 will be publicly available later this week.  New features in Beta 2 includes the following:

  • UI Framework: Beta 2 includes improvements in animation support, error handling and reporting, automation and accessibility support, keyboard input support, and general performance.  This release also provides more compatibility between Silverlight and WPF.
  • Rich Controls: Beta 2 includes a new templating model called Visual State Manager that allows for easier templating for controls. Other features include the introduction of TabControl, text wrapping and scrollbars for TextBox, and for DataGrid additions include Autosize, Reorder, Sort, performance increases and more.  Most controls are now in the runtime instead of packaged with the application.
  • Networking Support: Beta 2 includes improved Cross Domain support and security enhancements, upload support for WebClient, and duplex communications ("push" from server to Silverlight client).
  • Rich Base Class Library: Beta 2 includes improved threading abilities, LINQ-to-JSON, ADO.NET Data Services support, better support for SOAP, and various other improvements to make networking and data handling easier.
  • Deep Zoom: Beta 2 introduces a new XML-based file format for Deep Zoom image tiles, as well as a new MultiScaleTileSource that enables existing tile databases to utilize Deep Zoom. Better, event driven notification for zoom/pan state is another improvement in Silverlight 2 Beta 2.

Silverlight Training Videos

[On10]Thanks to Tim Sneath's blog, I stumbled upon a resource that is sure to please anyone interested in developing in Silverlight and wanting to learn more. The website, created by Mike Taulty and Mike Ormond, is http://www.silverlightscreencasts.com and there you will find 50 free videos that cover all things Silverlight from layout and controls to data binding and styling, and much more. There are even some great tips and tricks that go beyond what you'll find in the documentation. Of course, you'll need Silverlight 2 to view these, so load it up and then check it out!

Posted by Felix Wang | 0 Comments
Filed under: , ,

Windows Live Quick App & Clubspaces: Field Manager

Clubspaces logo[Via]Clubspaces is an online social networking community which helps you to create and manage your own club online, communicate with members and connect with other clubs.  Clubspaces lets you freely manage your club (sports or social) operations, communicate with your members or parents and connect with other online clubs.  Clubspaces, built on the Microsoft platform, enables you to quickly setup, manage, communicate, and connect with your club members. 

Recently, we worked with Clubspaces to envision how they could leverage a number of Windows Live Services and new technologies like Silverlight.  It quickly became apparent that there was a great opportunity to develop a solution that provided huge value to Clubspaces and its customers.  It was also planned that the source would be made available to the Developer community and essentially anyone that would like to download the source code, customize it, and use the Field Manager Quick App.

Clubspaces and Microsoft partner, SharpLogic developed and released the beta of (MyGameDay) Field Manager, a Windows Live Quick App* to Codeplex

CodePlex is Microsoft’s open source project hosting web site.  *Windows Live Quick Applications Beta provide customizable out-of-the box solutions for specific Web scenarios. Each Quick App is built on Windows Live services and is offered as a source code download for you to use today.

Clubspaces FM Quick app

The Field Manager app provides the following functionality:

  • Real time Maps
  • Real time weather
  • RSS Feeds
  • Alerting text/email
  • Live Maps Search
  • Easy brand/ad integration
  • Announcements
  • Easy to use Administration

The Field Manager utilizes the following Software and Windows Live Services:

You can download the Field Manager Live Quick Application project on Codeplex here.

Posted by Felix Wang | 1 Comments

Silverlight Steaming: Video File Permlink and Robust Uploader

With Silverlight 2 Beta 1, now we can pause and resume uploading:

[read]

And now we can also address a WMV file directly: http://silverlight.services.live.com/accountId/fileSet/fileName.wmv [read]

Posted by Felix Wang | 0 Comments
Filed under: ,
More Posts Next page »
 
Page view tracker