XAML and XAML Namespaces
XAML is a declarative XML-based language that is used as a user interface markup language in Windows Presentation Foundation and the .NET Framework 3.0. With XAML you can create a graphically rich customized user interface, perform databinding, and much more. For more information on XAML and the .NET Framework 3.0, please see http://www.microsoft.com.
XAML Namespaces
Namespaces organize the objects defined in an assembly. Assemblies can contain multiple namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and simplify references when using large groups of objects such as class libraries.
When you create a Microsoft Expression Blend project, a XAML file is created for you, and some initial namespaces are specified:
Namespace |
Description |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
This is the default Windows Presentation Foundation namespace. |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
This is a XAML namespace that is mapped to the x: prefix. The x: prefix provides a quick, easy way to reference the namespace, which defines many commonly-used features necessary for WPF applications. |
When you add a C1Scheduler control to the window, Blend automatically creates a namespace that looks like the following:
xmlns:c1sched="http://schemas.componentone.com/wpf/C1Schedule"
You can also choose to create your own custom name for the namespace. For example:
xmlns:MyC1Schedule="http://schemas.componentone.com/wpf/C1Schedule"
You can now use your custom namespace when assigning properties, methods and events. For example, to set the C1Scheduler.WeekStyle property, use the following XAML:
<MyC1Schedule:C1Scheduler Style="{x:Static MyC1Schedule:C1Scheduler.WeekStyle}"/>
Note: We will use the c1sched namespace throughout the documentation for consistency, but you may use any custom namespace desired.
|