Broadcast the seeds of Silverlight

Source: Internet
Author: User
After so long, I finally decided to learn Silverlight. Start with the most basic Quickstart.

1. Quickstart Part1
1. Preparations
A typical sliverlight requires four files
A. an HTML file used to store the Silverlight plug-in
B. Silverlight. JS File
C. a xaml File
D. And a JS file used to support HTML files

2. Start
Find Silverlight. js from the SDK and insert it into the HTML page.
<SCRIPT type = "text/JavaScript" src = "Silverlight. js"> </SCRIPT>
Create createsilverlight. js to create the Silverlight plug-in.
<SCRIPT type = "text/JavaScript" src = "createsilverlight. js"> </SCRIPT>
Then, Create HTML elements for storing the Silverlight plug-in, such as Div. The ID must be declared as mysilverlightpluginhost.
Insert the following script block under this Div:
<SCRIPT type = "text/JavaScript">
// Retrieve the DIV element you created in the previous step.
VaR parentelement =
Document. getelementbyid ("mysilverlightpluginhost ");

// This function creates the Silverlight plug-in.
Createmysilverlightplugin ();
</SCRIPT>
Then add the following script to the createsilverlight. js file:
Function createmysilverlightplugin ()
{
Silverlight. Createobject (
"Myxaml. XAML", // source property value.
Parentelement, // DOM reference to hosting Div tag.
"Mysilverlightplugin", // unique plug-in ID value.
{// Per-instance properties.
Width: '200', // width of Rectangular Region
// Plug-in area in pixels.
Height: '200', // height of Rectangular Region
// Plug-in area in pixels.
Inplaceinstallprompt: false, // determines whether to display
// In-Place install prompt if
// Invalid Version Detected.
Background: '# d6d6d6', // background color of plug-in.
Iswindowless: 'false', // determines whether to display plug-in
// In windowless mode.
Framerate: '24', // maxframerate property value.
Version: '1. 0' // Silverlight version to use.
},
{
Onerror: NULL, // onerror property value --
// Event handler function name.
Onload: NULL // onload property value --
// Event handler function name.
},
Null); // context value -- event handler function name.
}
Now, we have created the Silverlight content.
Create the myxaml. XAML file because the file name is specified in the previous step.

Ii. Quickstart Part2
1. Create a canvas and namespace Declaration
Each XAML file starts with a canvas element, just as HTML starts with HTML.
<Canvas
Xmlns = "http://schemas.microsoft.com/client/2007"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml">
</Canvas>

2. Draw something
<Ellipse
Height = "200" width = "200"
Stroke = "black" strokethickness = "10" fill = "slateblue"/>
This statement draws a circle with PX in width and height. The border color is black, the Border width is 10 PX, And the fill color is slateblue.

3. view the XAML content
Now, check the HTML file in the browser to preview the result.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.