You can use vs2010 or Expression Blend to create Silverlight projects or modify existing projects.A Silverlight application project is created by using the Silverlight Application project template. Use the following steps to create a new Silverlight application project.
Start Visual Studio 2010.On the file menu,click New and then Project. The New Project dialog Box appears.In the Installed Templates pane,expand the Visual C# or the Visual Basic node and select Silverlight. In the List of templates,select Silverlight Application. The following illustration shows an example of the Silverlight project templates.
Specify a name and a location for the application and then click OK.The New Silverlight Application dialog Box appears as shown in the following illustration.
Select a method for hosting your Silverlight application.Uncheck the Host the Silverlight application in a new Web site check Box if you do not want to use a Web site to host your Silverlight application. Instead,an HTML test page will be generated to host your application.
Check the Host the Silverlight application in a new Web site check Box if you want to add a separate ASP.NET Web site or ASP.NET Web Application Project to your solution to host the Silverlight application. If you select this option,you must also specify the New Web project name and New Web Project Type.
From the Silverlight Version drop-down List,select the version of Silverlight that you want to target.Click the OK button.
To build the Silverlight application project,in the Build menu,click Build Solution.
To deBUG the Silverlight application project,in the DeBUG menu,click Start DeBUGging.
To run the Silverlight application project,click Start Without DeBUGging.
Silverlight Application Project files
A Silverlight application project contains the following configuration,assembly references,and code files:
AppManifest.xml : This is the application manifest file that is required to generate the application package. You must not edit this file.
AssemblyInfo.cs or AssemblyInfo.vb : This file contains the name and version Metadata that is embedded into the generated assembly.
.xap file : This is the Silverlight application package. It is generated when the Silverlight application project is built. An application package is a compressed zip file that has a .xap file extension and contains all the files that you need to start your application. For more information about a Silverlight application package,see Application Structure.
A Silverlight application project contains references to the following assemblIEs:
mscorlib.dll
System.dll
System.Core.dll
System.Net.dll
System.windows.dll
System.windows.browser.dll
System.Xml.dll
MainPage files : The MainPage class is used to create the user interface for the Silverlight application. The MainPage class derives from UserControl. You can implement the MainPage class by using MainPage.xaml for XAML markup and MainPage.xaml.cs or MainPage.xaml.vb for the code-behind.
App files : The App class is required by a Silverlight application to display the application user interface. The App class is implemented by using App.xaml and App.xaml.cs or App.xaml.vb. The App class is instantiated by the Silverlight plug-in after the application package (.xap file) is created.
Test Page : A single HTML page (TestPage.HTML) is generated to host your application if you do not check the Host the Silverlight application in a new Web site check Box in the New Silverlight Application dialog Box.
总结以上是内存溢出为你收集整理的Silverlight – 02 :The first Silverlight Application全部内容,希望文章能够帮你解决Silverlight – 02 :The first Silverlight Application所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)