locked
Why are there two formats to the WpfToolkit namespace? When should I use each? RRS feed

  • Question

  • Hi, when restyling the Wpf Toolkit Datagrid I discovered that Expreesion Blend uses a Wpf Toolkit namespace in the [first] format:

    xmlns:Custom="http://schemas.microsoft.com/wpf/2008/toolkit"
    

     I've always used the namespace [second format]:

    xmlns:WpfToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit" 
    

    They are different since substituting the second format into the Expression Blend restyling resulted in unknown tags, among other things.

    Why are there two namespace formats? Is there a penalty for using the first format? Should I ever use the second format?

    Thnaks, Graeme

    Monday, February 28, 2011 12:22 AM

Answers

  • Well, they are slightly different.

    The frst example you provided allows for a namespace declaration to map to multiple CLR namespaces.  For example, System.Windows and System.Windows.Controls maps to the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace, allowing you to reference any controls from either mapped CLR namespace from a single declaration.

    The second example is a fully qualified namespace declaration.  It only maps to a single CLR namespace and you will only have access to controls in that single CLR namespace.

    For more information on namespaces please visit this link: http://msdn.microsoft.com/en-us/library/ms747086.aspx

    • Marked as answer by GRichardson Monday, February 28, 2011 5:53 AM
    Monday, February 28, 2011 4:37 AM