|
| ||||||||||
| Tags: adobe flash, framework, microsoft, multimedia, programming language, silverlight |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Silverlight Tutorial
It is an alternative to Flash, a plugin lightweight, less than 2 megabytes in version 1.0, which installs the application on the user's browser and complete with a GUI interacting with the server. This is actually a subset of WPF, light to be portable. With Silverlight you can create RIA, rich Internet applications, perform amazing interfaces, integrate animations, videos. It offers a browser portion of the graphics capabilities of WPF and that are the same as what Flash plugin from Adobe. - Uses XAML - 2D vector graphics with resizing of objects. - Works with Ajax so JavaScript, DOM and XMLHttpRequest. Silverlight also works in local mode. NET environment. On the Web, the components are accessible through Active X in Internet Explorer while Firefox and other browsers use the Mozilla plugin system. The possibilities of Silverlight : - HTML Integration Silverlight is programmed in JavaScript. It uses DOM to access elements of the page and the JavaScript event control the graphical objects in Silverlight. - XAML It uses XAML to describe the graphical interface. It can generate XAML from data on the server, and create a dynamic application. The method createFromXaml called in JavaScript creates the graphic component (widget) equivalent on the page. - Vector Graphics The image size does not affect their accuracy. It can reduce or enlarge the same maintaining perfect image. The runtime is fast enough to use a video as a texture object in 2D. - Videos It supports video files in wmv format, in high definition. Several videos can run at the same time and some interactivity such as zooming is possible. - Compatible Fully compatible with WPF, the graphics platform. NET and Vista. WPF has 3D and more. We can reuse a Web application in the local environment. ![]() |
|
#2
| |||
| |||
| Re: Silverlight Tutorial Flash-killer : The format of Adobe (formerly Macromedia) has become a sort of standard on the web. It allows you to run graphical applications on the browser after downloading a plugin. It is also used for Web applications, including the framework. Microsoft hopes to dethrone a product adapted to modern technologies of the Web. It is also a plugin, but lighter and it also works on major browsers. But Flash works on Linux, while Microsoft only provides a runtime for Windows and Mac. However a version of Silverlight for Linux started under the code name Moonlight on the site of Mono platform compatible. NETs. Programming : Microsoft offers a set of tools called Expression, the software equivalent of Adobe Creative Suite. Visual Studio can also generate Silverlight applications. The Silverlight controls can be used in different ways: they are defined with a tag OBJECT or EMBED with JavaScript or by loading a XAML file, or a XAML content is created dynamically. Once defined, the object is used with JavaScript. Platforms recognized : - Windows XP with SP2. - Windows 2000. - Windows Vista. - Windows Mobile. - Macintosh. - Linux under the name of Moonlight. Creating a Silverlight project : We begin the tutorial with the creation of a project for a Web application running in a browser, and requires the plug-in Silverlight. 1) Install the SDK The Silverlight SDK includes a tutorial and documentation in English. The first step is to download and install it. See the instructions on the sheet Silverlight and the downloads page. Once it is installed, the browser can display web pages that have a rich graphical interface. 2) Create a directory For example c: \ demo, or will put your project. 3) Copy the script You will find the init script on the following path: Code: Program Files / Microsoft Silverlight 1.0 SDK / Tools / Silverlight.js / Silverlight.js 4) Create a Web page. For example can use SampleHTMLpage.html in the directory QuickStarts \ quickstart \ samples \, but any page, created by Star Office for example, may agree. The example provided here is called mypage.html. 5) Insert the script The script is inserted into the Web page with the following line, placed between the <head> and </ head>: Code: <script type="text/javascript" src="Silverlight.js"> </ script> Code: <script type="text/javascript" src="script.js"> </ script> The program is inserted into the XAML page as ActiveX control. This requires a container, usually a <div>, and initialization code. We can actually create more controls, so many couples container / initializer. Practically we create the ActiveX control by adding a line in the Web page, between the <body> and </ body>: Code: <! - Where the Silverlight plugin Will Go -> <div id="Control"> </ Div> Insert the code below after the previous line. Code: <script type="text/javascript">
Silverlight.createObject (
"tmcl.xaml"
parentElement,
"ControlID"
(
width: '300 '
height: '300 '
inplaceInstallPrompt: false,
background: '# D6D6D6',
isWindowless: 'false'
framerate: '24 '
version: '0 .9 '
)
(
onError: null,
onLoad: null
)
null
)
</ Script> 8) Create the XAML source file It is a simple text file, whose name, we have seen above will monxaml.xaml. Unless you have used a different name by setting initialization ... The structure of a XAML file for Silverlight is: Code: <canvas Xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> ... </ Canvas> - mypage.html - Silverlight.js - script.js (optional) - xaml.xaml |
|
#3
| |||
| |||
| Re: Silverlight Tutorial First Program : We begin with a simple example that displays the classic "Hi World!". You have already created a Silverlight project as the previous chapter, you have an HTML page, mypage.html, and the necessary files in the directory of your project. 1) Create a canvas The XAML content to fit within the guidelines Canvas in Silverlight environment: Code: <Canvas xmlns = "http://schemas.microsoft.com/client/2007" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"> </ Canvas> 2) Add a text block The TextBlock tag allows you to place text in the canvas: Code: <TextBlock> Hello World! </ TextBlock> 3) Define the attributes You can choose the font, size, color and other text attributes. Code: <TextBlock FontFamily = "Verdana" FontSize = "20"> Hello World! "/ TextBlock> 4) The complete XAML Code: <Canvas
xmlns = "http://schemas.microsoft.com/client/2007"
xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock
FontFamily = "Verdana"
FontSize = "29">
Hello World!
</ TextBlock>
</ Canvas> 5) Show page You can now view the page mypage.html with a browser, Internet Explorer, Firefox or another. The Syntax of XAML : XML syntax XAML is a markup language derived from XML. The widgets are defined by tags open or closed, feature attributes. Example of tag with content: Code: <TextBlock> A text </ TextBlock> Code: <TextBlock /> Code: <TextBlock Name="t1" /> <TextBlock Name="t1"> A text </ TextBlock> Code: <TextBlock Text="some text /> Syntax properties : An object properties, by which we mean that characterizes it, can be written as an attribute. For example, the background color property of a rectangle is written with the Fill attribute: Code: <Rectangle Fill="Red" /> Code: Element.properties Code: <Rectangle> <Rectangle.Fill> </ Rectangle.Fill> </ Button> Code: <button> <Button.ContextMenu> <ContextMenu> <menuitem> Open </ MenuItem> <menuitem> Close </ MenuItem> </ ContextMenu> </ Button.ContextMenu> </ Button> Code: <TextBlock Text="Some Text" /> Namespaces : Namespaces are specificities as attributes of the container as overall file XAML Canvas or Window, or Page. These are predefined URL that will be given in the examples which correspond to the type of XAML definition. Example: Code: <canvas Xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> Code: x: Nomel Properties attached : It is a concept for XAML. The syntax is the same as the elements of property seen above, connects one property name to a type name (rather than an element name such as Button). Code: Type.properties Events attached : In XAML, you can define an event by type, while the handlers are attached to objects represented by tags (such as Button). The syntax is always the same: Type.environment Extensions : It is possible to extend the XAML using a special syntax: () is placed between the extension, consisting of a class name followed by the body. Example from the language specification: Code: <TextBlock Style="{StaticResource Style}"> A text </ TextBlock> Characteristic : Sensitivity : XAML is case sensitive. The initials of the words in capital letters must be preserved. This does not necessarily apply to attribute values, and true and true are eligible, if the parser recognizes them. Whitespace : The extra spaces are ignored, and special characters such as the code tab, equivalent to a space. Root tag : Like any XML document, a XAML definition must be enclosed within a single tag, called the root element. WPF for a page, the container is the tag page. For Silverlight, it is Canvas. For a local application is Windows. Gadgets For SilverLight |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Silverlight Tutorial" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Silverlight 5 released; will there be a Silverlight 6? | GopuHD | Windows Software | 4 | 11-01-2012 01:28 PM |
| While installing Silverlight I get "Silverlight is already installed" message | Raja Ram | Windows Software | 5 | 28-04-2011 10:27 AM |
| How to install SilverLight 5 beta and SilverLight 4 on same Computer | Mandarmalika | Windows Software | 3 | 17-04-2011 04:55 PM |
| XAML Processing Differences Between Silverlight 3 and Silverlight 4 | wllwnn | Guides & Tutorials | 2 | 09-08-2010 09:41 AM |
| Need HQL Tutorial | chickens | Software Development | 3 | 31-07-2009 10:12 PM |