[Memo] Silverlight library prefix and ing

Source: Internet
Author: User
Tags mscorlib reflector

This topic introduces the concept of default Silverlight XAML namespace, and describes how to define a Silverlight-based application in XAML.ProgramThe reason for creating a ing for the attached XAML namespace.

 

 

This topic contains the following sections.

    • XAML namespace ing
    • The prefix displayed in the Silverlight document for Silverlight library ing
    • Silverlight default XAML namespace
    • Map other XAML namespaces from the core library
    • Used for the XAML of the SDK client library
    • The Silverlight Toolkit's XAML
    • The xaml used for the Silverlight SDK assembly when the target is Silverlight Version 3
    • Related Topics

 

 

XAML namespace ing

Silverlight XAML usually uses the default XAML namespace for UriHttp://schemas.microsoft.com/winfx/2006/xaml/presentation. This XAML namespace maps to the type defined in the core Silverlight assembly (for example, system. Windows. However, the. NET Framework class library of Silverlight also includes references to the Assembly and type outside the core Silverlight assembly. These types are available in Silverlight XAML, but they require you to map the CLR namespace and assembly to a prefix and a XAML namespace. Generally, you implement this in the root element of the XAML page. Then, you use this prefix in other XAML usage on the page to reference the type in the ing. For more information, seeSilverlight XAML namespace and XAML ing the XAML namespace as a prefix. Visual Studio XAML editing includes a feature that displays a drop-down list when you define a new xmlns value to help simplify the ing process.

The XAML usage and XAML examples found in the Silverlight document usually use certain prefix strings for the XAML namespace according to the Conventions. The XAML usage or XAML examples in the Silverlight document usually show only prefixes instead of root elements and mappings for simplified purposes. You can find the table in the next section to determine the required prefix and Its ing. For more information about other conventions used to describe the XAML syntax in the Silverlight document, seeXAML usage syntax.

The prefix used in the usage and example is consistent with the recommended prefix (declared as an assembly-level attribute in the Silverlight SDK client library and assembly that may come from other sources, these recommended prefixes are generally recommended by development tools.

The prefix displayed in the Silverlight document for Silverlight library ing

Libraries used to define classes used in Silverlight XAML may belong to one of the following categories:

    • Libraries that are not part of the Silverlight core installation.All Silverlight clients have these libraries, so you do not have to distribute or package these libraries to access their classes. Examples of the core library include mscorlib and system. Windows.

    • Libraries that are not part of the Silverlight SDK installation.Sub-categories of these libraries are SDK client libraries and SDK server libraries. Only SDK client libraries are associated with XAML. The SDK client library examples include system. Windows. Controls and system. Windows. Data.

    • Silverlight toolkit.The Silverlight toolkit provides libraries and other developer resources for Silverlight developers. It provides new Silverlight toolkit versions that do not need to be synchronized with the Silverlight core version plan. Sometimes, the libraries and types contained in the previous Silverlight Toolkit can be incorporated into the SDK client or Silverlight core library of subsequent versions. One library example in the Silverlight toolkit for the time range of Silverlight 4 is system. Windows. Controls. datavisualization. toolkit. Note that the types from this Silverlight toolkit are not directly recorded in this document set. Instead, the Silverlight toolkit delivers its own class library documentation. However, the following sections will discuss common techniques for using the Silverlight toolkit-type XAML.

    • Third-party libraries.To reference A type from a third-party library in XAML, you must map the XAML namespace. For more information, seeSilverlight XAML namespace and XAML ing the XAML namespace as a prefix.

Silverlight default XAML namespace

The Silverlight default XAML namespace displayed in xmlns ing isHttp://schemas.microsoft.com/winfx/2006/xaml/presentation. For reasons of support for the old version,Http://schemas.microsoft.com/client/2007/The identifier is considered to be equivalent to the default XAML namespace used to identify Silverlight.

Default XAML namespace in the entire SilverlightHttp://schemas.microsoft.com/winfx/2006/xaml/presentationAll types referenced in are from one library, namely system. Windows.

By default, Silverlight uses the XAML namespace to reference multiple CLR namespaces. The following is a list of CLR namespaces. These namespaces contain types that can be referenced through the Silverlight default XAML namespace, provided that the relevant types can be found in the Silverlight core library system. Windows:

  • System. Windows

  • System. Windows. Controls

  • System. Windows. Controls. primitives

  • System. Windows. Data

  • System. Windows. Documents

  • System. Windows. Ink

  • System. Windows. Input

  • System. Windows. Markup

  • System. Windows. Media

  • System. Windows. Media. Animation

  • System. Windows. Media. Effects

  • System. Windows. Media. Imaging

  • System. Windows. Media. media3d

  • System. Windows. Shapes

  • System. Windows. Automation(UsedAutomationpropertiesAdditional attributes)

Map other XAML namespaces from the core library

other types defined by the Silverlight core library are sometimes related to the Silverlight application and its xaml usage, but are not defined in the system. Windows assembly. Therefore, the default XAML namespace does not contain these types. To use a type other than the default XAML namespace, you must map a prefix to The XAML namespace. For other core libraries, this means that you must map the XAML namespace and CLR-namespace and Assembly components, instead of referencing the namespace identifier of the URI style. For more information, see Silverlight XAML namespaces and XAML ing XAML namespaces to prefixes .

A common set of types in Silverlight XAML is the CLR type corresponding to the language primitive. For example,StringIs the CLR type of a string. These types areSystemCLR namespaces and mscorlib programs are defined in a centralized manner. In general, the prefix will be declared for this XAML namespace ingSYS:And this Convention is sometimes used in this document or related Silverlight examplesCode. For example,Xmlns: SYS = "CLR-namespace: system; Assembly = mscorlib"Yes, you can limit the usage of XAML (for example<SYS: int32> 42 </sys: int32>. Generally, you can find the language primitive used by XAML as part of the resource dictionary, so that common primitive values only exist in one position in the application. For more information, seeResource dictionary.

Which types of mappings can actually be used in XAML is a separate concept, which is not fully discussed in this topic. Generally, this type must be public and support the default constructor. For more information, seeXAML and custom classes(The same CLR rules for custom type XAML usage also apply to any existing classes in the core library ).

Used for the XAML of the SDK client library

As of Silverlight 4, all the libraries distributed as part of the Silverlight client SDK share a public XAML namespace. The identifier of the XAML namespace is:

Http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk

The typical prefix for ing this XAML namespace isSDK:.

If you use the toolkit of Visual Studio 2010 and the Silverlight visualization designer, you can drag the type control from the SDK client library to the design surface. If this is the first time you use the SDK client type from this XAML page, Visual Studio 2010 automatically adds a XAML namespace definition to the XAML on the root element:

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

Http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdkIncluding types of the following Assembly and namespaces from these assembly:

Assembly

CLR namespace

System. Windows. Controls

System. Windows. Controls

System. Windows

System. Windows. Controls. Data

System. Windows. Controls

System. Windows. Controls. primitives

System. Windows. Controls. Data. Input

System. Windows. Controls

System. Windows. Controls. Input

System. Windows. Controls

System. Windows. Controls. Navigation

System. Windows. Controls

System. Windows. Navigation

System. Windows. Data

System. Windows. Data

Note:

The table above is provided only for convenience. For an assembly with expected XAML usage, the CLR attribute is used to declare the identified behaviors of the xaml namespace, and these behaviors are explained by the XAML users (such as different components of Visual Studio 2010.

In addition to using the toolkit of Visual Studio 2010 and the Silverlight visualization designer, you can also manuallyHttp://schemas.microsoft.com/winfx/2006/xaml/presentation/sdkDefine your own ing and use the XAML ing of the XAML namespace to reference the SDK client type from your XAML.

if you want to use a CLR namespace and SDK client library combination that is not part of the http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk , the combination must be specifically mapped, as described in the topic Silverlight XAML namespace and The XAML ing of the XAML namespace as the prefix .

Note:

From system. Windows. Controls assemblySystem. Windows. Controls. primitivesThe CLR namespace type is notHttp://schemas.microsoft.com/winfx/2006/xaml/presentation/sdkA Part Of The XAML namespace. To use the library from system. Windows. Controls andSystem. Windows. Controls. primitivesThe type of the CLR namespace, which must be mapped to a XAML namespace with a prefix. For more information, seeSilverlight library prefix and ing.System. Windows. Controls. primitivesThe namespace usually contains only the types used for templating and combining the main SDK client library controls.

Control template XAML

The default control template may still use the Silverlight 3 style ing, because the default control template may support both the Silverlight 3 usage and the Silverlight 4 usage. The XAML you load for Silverlight 4 supports any Silverlight 3 style ing, as long as it is correctly resolved to a backup type in the Silverlight 4 Version assembly. You can use Silverlight 3 style ing and Silverlight 4 style ing in XAML, even in the same file and for the same type.

The Visual Studio design surface behavior of the Silverlight 4 target is: if there is an existing Silverlight 3 style ing for the CLR namespace/assembly combination, the generated XAML will reuse this ing. Generated only when no ing existsSDK:Prefix ing. In this way, if you are using the default control template starting point found in this article, you can use the existing Silverlight 3 style ing in the new control template. Visual Studio and related tools or processes (such as F1, edit compilation or runtime loading) can use Silverlight 3 style ing or Silverlight 4 style ing to parse this type.

The Silverlight Toolkit's XAML

As of Silverlight 4, The Silverlight tool package Library also shares a public XAML namespace. The identifier of the XAML namespace is:

Http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit

The typical prefix for ing this XAML namespace isToolkit:.

If you use the toolkit of Visual Studio 2010 and the Silverlight visualization designer, you can drag the type control from the Silverlight toolkit to the design surface. If this is the first time you use the Toolkit type from this XAML page, Visual Studio 2010 automatically adds a XAML namespace definition to the XAML on the root element:

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

This topic does not list the types of the Silverlight toolkit.Http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkitAnd the CLR namespace list. For more information, see the documentation distributed with the Silverlight toolkit.

You can also use a reflection tool (such as. Net reflector) to check the Silverlight toolkit assembly and read assembly for raising its XAML features to the same CLR attributes of the designer and marking the compiler. Open the Assembly in. Net reflector, disassemble it, and check anyXmlnsdefinitionattribute. ForHttp://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkitIn the Toolkit type of XAML usage, you must specifically map the Assembly and definition CLR namespace to a XAML namespace and prefix.

The xaml used for the Silverlight SDK assembly when the target is Silverlight Version 3

In the SDK client assembly of Silverlight 3, The XAML namespace is not defined.Http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk. Conversely, if you create a specific XAML namespace ing for the CLR namespace in the Assembly, the Assembly declares the recommended prefix.

If you use the toolkit of Visual Studio 2010 and the Silverlight visualization designer, you can drag the type control from the SDK client library to the design surface. If this is the first time you use the SDK client library type from this XAML page, Visual Studio 2010 automatically adds a XAML namespace definition to the XAML on the root element: For Silverlight 3, this XAML namespace declaration is defined by providing the CLR namespace and assembly for the control's backup type. Different assembly/CLR namespaces in the client library have different prefixes. For example, when a prefix is introduced to XAML,DataGridDefine and useData:Prefix, andCalendarDefine and useControls:Prefix.

You can also manually define mappings in XAML and upgrade the same prefix in Visual Studio UI. For more information about manually defining the XAML namespace ing, seeSilverlight XAML namespace and XAML ing the XAML namespace as a prefix.

InSilverlight. NET Framework class libraryOnlySDK:Prefix andHttp://schemas.microsoft.com/winfx/2006/xaml/presentation/sdkThe Silverlight 4 syntax of the XAML namespace. However, you may encounter Silverlight 3 style XAML and specific CLR namespace ing, even if the target is Silverlight 4. For example, the default control template may still use the Silverlight 3 style ing.

The following table lists the prefix and ing of the specified XAML namespace, which will be upgraded by the Assembly-level attribute in the SDK client library of Silverlight 3.

Prefix

Assembly

CLR namespace

Controls

System. Windows. Controls

System. Windows. Controls

Common

System. Windows. Controls

System. Windows

Controlsprimitives

System. Windows. Controls

System. Windows. Controls. primitives

Data

System. Windows. Controls. Data

System. Windows. Controls

Datainput

System. Windows. Controls. Data. Input

System. Windows. Controls

Datemedimitives

System. Windows. Controls. Data

System. Windows. Controls. primitives

Input

System. Windows. Controls. Input

System. Windows. Controls

Navigation

System. Windows. Controls. Navigation

System. Windows. Controls

Urimapper

System. Windows. Controls. Navigation

System. Windows. Navigation

Description
    • CommonOnly related to one class:Hierarchicaldatatemplate.

    • InputOnly related to one class:Autocompletebox.

    • Default template ing in system. Windows. Controls. Data. Input assembly and prefixCTL, RatherDatainput.

See Concept XAML Overview Other resources XAML usage syntax Readme file location: MK: @ msitstore: C: \ Users \ SZW \ Desktop \ chs_silverlight_4.chm:/html/424fbfea-b3c6-4e66-9db7-9d1eba96de67.htm

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.