app.xaml
file can be created containing an application resource Xml construct. The target type for each style is set to the control on which the style needs to be applied. <Application.Resource>
<Style x:Key="MyBorder" TargetType="Border">
<setter property="width" value="5">
</style>​
<Border Style="{StaticResource MyBorder}">
...
</Border>​
AppManifest.XAML
: It consist the list of all the entry points including the class and assembly. This file can be taken and hosted in any HTML file using an object tag.<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="100%"><param name="source"
value="MySilverLightControl.xap"/></object> ​
Silverlight.js
and CreateSilverlight.js
: contains the initialization of the Silverlight plug-in that will be used in HTML pages.Visual C#
or Visual Basic to code the backend of the silverlight application. Here backend means the code behind files for the Sivlerlight pages. Silverlight | Windows Presentation Foundation (WPF) |
---|---|
It is a subset of WPF. | All Silverlight features are also incorporated in WPF. |
Silverlight is used for the development of premium browser-based internet applications. | WPF is utilized for the development of graphical applications for the development platform. |
App.xaml.cs
file. Subsequently in the Application_Startup
handler, set the RootVisual property to the particular Silverlight class. Consider the following example :MainPage.xaml
, there must exist a class known as MainPage with MainPage.xaml.cs
private void Application_Startup (object sender, StartupEventArgs)
{
this.RootVisual = new MainPage();
}
.xap file
is a compressed file for the Silver Application. It contains AppManifest.xaml
, compile output assembly of the Silverlight project (.dll
) and any other resources by the Silverlight application. Visual studio creates two files while creating project; App.xaml
and Page.xaml
. .xap file
is used to contain and transfer the assemblies and resources of a managed code application. This managed code application should be run within the Silverlight 2 browser plug-in. IIS (Internet Information Server)
. If you want to host Silverlight application from your web server, you need to allow the following MIME type
.Extension | MIME Type |
---|---|
.XAML | Application/ XAML+XML |
.XAP | Application/ Silverlight-app |
App.xaml.cs
file :Application.Current.Host.Content.IsFullScreen = true;
Silverlight 1.0 | Silverlight 2 |
---|---|
All the code has to be purely written in JavaScript and XAML. | There is no such specification for Silverlight 2. |
The XAML code is directly referenced by the object embedded with the browser. | The embedded object is referenced using the XAP packages that essentially contains the XAP files, resources and assemblies |
If (NetworkInterface.GetIsNetworkAvailable())
{
Messagebox.Show("Network available");
}
else
{
Message.box.Show("Network not available");
}​
Silverlight.js
is a helper file which enables websites to create advanced Silverlight installation and instantiation experiences. You can call the createObject and createObjectEx
functions defined in this file to embed the Silverlight plug-in in a web page. AppManifest.xaml
file : Collapse The first element in AppManifest.xaml is a Deployment node. This node defines the application, and contains the child AssemblyPart nodes. As you can see the AssemblyPart nodes define what assemblies (DLLs) are contained within the .xap file
, and give each of them a name. Now, if you look back up to the top, you'll see the Deployment node has the EntryPointAssembly and EntryPointType attributes. The EntryPointAssembly attribute defines which assembly defined below (as a child AssemblyPart node) is the main assembly (DLL) for the application. And, the EntryPointType attribute specifies the class contained within the assembly (DLL), defined in the EntryPointAssembly attribute, is the main class that will be instantiated to start the application. The Deployment node also has a RuntimeVersion attribute that defines the version of Silverlight the application is built for. MainPage.xaml
". This is just a dummy start page created by Visual Studio, and it does not contain any visible UI elements. The default contents of the MainPage.xaml
file looks like this: Collapse