Accessing MCML Libraries

The most common top-level element within an MCML resource is the UI element. However, you can use any .NET object at the top level, which must be named and placed in a markup library. Markup libraries are typically used for accessing common objects, such as images, from one location.

Markup libraries are not global. Namespaces are available to avoid name collisions. Libraries are per-MCML resource, so namespaced library access is required. Use the following syntax to access a library:

library://namespace:identifier

You can use this syntax as a value to any property that accepts that type. For example, you can specify an image library (image://me:MyLogo), and then use it as a value in the Content property of the Graphic element, which specifies an image.

The following types are available:

  • All types from Microsoft.MediaCenter.UI.dll and Microsoft.MediaCenter.dll (the Microsoft.MediaCenter namespaces).
  • All primitive types (for example, Int32, Boolean, and so forth), String, DateTime, TimeSpan, and Random from MSCorLib.dll.
  • Uri classes from System.dll.

The following resource restrictions also apply:

  • MCML can only be served from the web host of the page that is initially loaded.
  • Images can come from any web source.
  • Sounds can come from any web source.

The set of predefined libraries are as follows:

Library Description
Image (image://) Stores Image types.
Sound (sound://) Stores Sound types.
Font (font://) Stores Font types.
Color (color://) Stores Color types.
Animation (animation://) Stores Animation types.
Global (global://) Stores all other types.

The following example shows how to access an MCML library.

<Mcml xmlns="https://schemas.microsoft.com/2008/mcml"
      xmlns:me="Me" >

  <Image Name="ImageLibrary" Source="file://E:\Resources\GreenBall.png" />

  <UI Name="MCMLLibraryAccess">
    <Content>
          <Graphic Name="FromImageLib" Content="image://me:ImageLibrary" />
    </Content>
  </UI>
</Mcml>

Sample Explorer

  • Fundamentals > Markup Libraries

See Also