Silverlight programming model, XAML, and HTML DOM

Source: Internet
Author: User
Tags html page object model silverlight

Silverlight-based applications use the Silverlight Plug-ins in the browser host to expose their functionality through a Browser-based Document Object Model (DOM) and a Silverlight-specific programming model that includes the concept of object trees. If you use the Silverlight programming model, you can select one of the following three API variants: JavaScript interpreted by the browser, managed code, or a dynamic language interpreted by the dynamic Language runtime (DLR). This topic discusses the relationship between DOM and each possible API variant, and discusses how various APIs and application models use XAML markup.

Document Object Model

The Document Object Model (DOM) is a general-purpose programming concept that is not a specific platform and is not a specific language. The DOM provides a structured representation of a document, such as a Web page, and a specified way to access and manipulate the structure, style, and content of a document. Each browser that can host the Silverlight runtime as a plug-in implements an HTML DOM that exposes elements of an HTML page, including Silverlight Plug-ins.

The World Wide Web Consortium (WWW) DOM standard forms the basis of DOM implemented in the most widely used browsers. But most browsers offer extensions that go beyond the standards of the consortium. As a result, developers need to recognize these differences in order to create content that is not specific to the platform. The browser DOM listed in the following table has access to Silverlight.

Dom Description
Gecko DOM (Mozilla, Firefox, Netscape version 6 and later, and other Mozilla based browsers) Gecko is a software component that handles HTML parsing, page layout, Document object models, and rendering of the entire application.
DHTML DOM (Internet Explorer) Dynamic HTML (DHTML) DOM provides authors with direct programmable access to the various components of their WEB documents, from individual elements to containers.

After the Silverlight plug-in is created (typically using the HTML object tag), you can retrieve a reference to the plug-in instance in the HTML DOM by referencing the ID of the plug-in instance. The following JavaScript example shows how to use the document.getElementById method to retrieve the ID of the Silverlight plug-in.

var plugin_1 = document.getElementById ("slplugin_1");

Silverlight programming Model

The Silverlight API defines its set of objects as an object tree so that you can populate the initial content of a Silverlight-based application by loading the XAML, and then adjust the object tree at run time. The Silverlight object tree is exposed through the Silverlight plug-in (created as a plug-in instance on a Web page). Silverlight uses the ActiveX plug-in model for Microsoft Internet Explorer and the Netscape API plug-in model for other browsers. You can use the managed APIs or JavaScript APIs to program against Silverlight, in most cases using the managed APIs.

XAML and Silverlight Object tree

The Silverlight plug-in is initially declared by the source parameter of the OBJECT tag (if the managed API is used and then processed by the Silverlight application model), providing content to the plug-in actually defines XAML elements in markup that have a root The hierarchical tree structure of the element. The parsed XAML creates the initial object tree of Silverlight.

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.