WP7 WP8 windows8 tutorial public basics Article 1 XAML Basics

Source: Internet
Author: User
ArticleDirectory
    • What is XAML: basic controls (How does XAML represent a control)
    • Namespace
What is the basis of XAML? XAML: basic controls (How does XAML represent a control)

Use button as an example to describe XAML

<Button tag = "I Am a button" content = "I Am a button" cursor = "eraser" Click = "button_click" padding = "5" margin = "5"/>

Namespace

According to the Conventions, the XAML namespace is mapped to the prefix X :.

The default project and file template of the Silverlight project always have the default XAML namespace (no prefix, only xmlns =) at the same time) and the XAML language namespace (mapped to the prefix x :) is defined as part of the root element.

Example:CodeSegment is the Silverlight ApplicationProgramThe usercontrol root created by the template on the initial Page (only the start tag is displayed and simplified ):

<Usercontrol

Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"

Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"

...>

X: the prefix/XAML Language XAML namespace contains multiple programming structures that will be frequently used in Silverlight XAML.

The most common X: prefix/XAML namespace structure is listed below:

X: Key

Set a unique user-defined key for each resource in resourcedictionary. The key tag string is used as a staticresource tag extension parameter to retrieve any of these resources from another XAML usage.

X: Class

Specify the CLR namespace and Class Name of the class that provides code hiding for the XAML page, and name the class created or linked in the Silverlight application model by generating the markup compiler operation. You must have such a class to support code hiding or initialization as rootvisual. For these reasons, you almost always see X: ing, even if there is no resource and you never use X: Name is no exception.

X: Name

After processing the object elements defined in XAML, specify the runtime object name for instances in the runtime code.

 

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.