1.Silverlight是什么
Silverlight是一个跨浏览器的、跨平台的插件,为网络带来下一代基于.NET的媒体体验和丰富的交互式应用程序。Silverlight提供灵活的编程模型,支持AJAX, VB, C#, Python, Ruby等语言,并集成到现有的网络应用程序中。Silverlight对运行在Mac或Windows上的主流浏览器提供高质量视频信息的快速、低成本的传递
Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web. Silverlight offers a flexible programming model that supports AJAX, VB, C#, Python, and Ruby, and integrates with existing Web applications. Silverlight supports fast, cost-effective delivery of high-quality video to all major browsers running on the Mac OS or Windows.
2.开发环境
运行时:
Microsoft Silverlight 1.1Alpha Refresh
开发工具:
Silverlight 1.1 Tools Alpha for Visual Studio 2008
设计工具:(可选)
3.HelloWorld
打开VS, 新建一个Silverlight Project, 修改默认生成的Page.xaml文件为:
<Canvas x:Name="parentCanvas"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Page_Loaded"
x:Class="SilverlightProject1.Page;assembly=ClientBin/SilverlightProject1.dll"
Width="640"
Height="480"
Background="White"
>
<TextBlock x:Name="txt" Text="HelloWorld" MouseLeftButtonDown="SayHi"/>
</Canvas>
修改Page.xaml.cs为:
using System;
using System.Windows.Controls;
using System.Windows.Input;
namespace SilverlightProject1
{
public partial class Page : Canvas
{
public void Page_Loaded(object o, EventArgs e)
{
// Required to initialize variables
InitializeComponent();
}
protected void SayHi(object sener, MouseEventArgs e)
{
this.txt.Text = "HelloWorld to Silverlight";
}
}
}
按ctrl+F5运行.
:)