Skip to content

Namespace Declarations

BSick7 edited this page Jun 11, 2015 · 4 revisions

There are slight differences between Silverlight/WPF and Fayde when declaring xml namespace prefixes. Fayde embraces a simpler, cleaner pattern. When trying to resolve types within a namespace, Fayde tries to resolve the library, then resolves the type within that library.

Directory Resolution

If a URI scheme is not specified, the type manager will resolve the directory relative to the application root, then resolve the type by requireing the xml tag. The following example will require("path/to/dir/Mock").

xmlns:xyz="path/to/dir"
<xyz:Mock />

Library Resolution

If the URI scheme lib:// is specified, the type manager will load the library based on Fayde.json definitions using the Uri.host as the library name. The remaining path of the URI will be used to resolve a module. The type will then be loaded from that module.

This example will load the library fayde.controls, then resolve TabControl.

xmlns:xyz="lib://fayde.controls"
<xyz:TabControl></xyz:TabControl>

This example will load the library fayde.controls, resolve the module Primitives, then resolve MenuBase.

xmlns:xyz="lib://fayde.controls/Primitives"
<xyz:MenuBase></xyz:MenuBase>

fayde.controls library is configured to export Fayde.Controls. Everything located in this module will be exported.

module Fayde.Controls { 
//Everything exported from this module will be available in XAML
}

Uris can be thought of as replacing / with ..

lib://fayde.controls/Primitives --> Fayde.Controls.Primitives
lib://fayde.controls/Some/Module --> Fayde.Controls.Some.Module

Defaults

The default namespaces for Fayde should be defined:

xmlns="http://schemas.wsick.com/fayde"
xmlns:x="http://schemas.wsick.com/fayde/x"

The default namespace contains 'Arrayas well as types from the Fayde library. Thex` namespace contains primitive types as well as some other primitives defined in the Fayde library.

  • String
  • Number
  • Double
    • resolves to Number
    • included for Silverlight compatibility
  • Date
  • RegExp
  • Boolean
  • Uri - defined by Fayde
Clone this wiki locally