Getting Started with WPF | ComponentOne Studio Edition
In This Topic
    XAMLand XAMLNamespaces
    In This Topic

    XAML is a declarative XML-based language that is used as a user interface markup language in Windows Presentation Foundation (WPF) and the .NET Framework 3.0 or later. With XAML you can create a graphically rich customized user interface, perform data binding, and much more. For more information on XAML, 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 WPF Edition control to the window in Microsoft Expression Blend or Visual Studio, Blend or Visual Studio automatically creates an XML namespace for the control. The namespace looks like the following:

    XAML
    Copy Code
    xmlns:My="http://schemas.componentone.com/winfx/2006/xaml"
    

    The namespace value is c1 and the namespace is http://schemas.componentone.com/winfx/2006/xaml. This is a unified namespace; once this is in the project, all ComponentOne WPF controls found in your references will be accessible through XAML (and IntelliSense). Note that you still need to add references to the assemblies for each control you need to use.

    You can also choose to create your own custom name for the namespace. For example:

    XAML
    Copy Code
    xmlns:My="http://schemas.componentone.com/winfx/2006/xaml"
    

    You can now use your custom namespace when assigning properties, methods, and events. For example, use the following XAML to add a C1Book with a border:

    XAML
    Copy Code
    <My:C1Book Name="C1Book1" BorderThickness="10,10,10,10">
    
    See Also