5
votes

We have used WPFToolKit and PresentationFramework 4.0 in our project. There are some common namespaces in both the dlls(assemblies).To resolve the namespace conflicts, we gave an Alias to WPFToolKit, that helped in code behind(.cs files)

Now in our XAML files, how do we specify the alias.

WPFToolKit DataGrid is not recognized

Error : The type or namespace name 'Controls' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

XAML namespace code

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

XAML DataGrid

<WpfToolkit:DataGrid Name="BlotterGrid" />
3

3 Answers

2
votes

The build errors got resolved by using Alias as "global,MyAlias" rather than "MyAlias". Thus in code file external alias "MyAlias" is used whereas in XAML global is used.

Reference : http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/87f0caa0-c57a-4146-a999-c794947ae28e

0
votes

Something like:

<Window x:Class="New_Project.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:toolkit="clr-namespace:WPFToolKit "
        Title="MainWindow" Height="350" Width="525">

    <StackPanel>
        <toolkit:DataGrid/>

    </StackPanel>
</Window>
0
votes

XAML alias for referenced dll (Assembly) is definde like that:

xmlns:MvvmFramework="clr-namespace:NamespaceName.MvvmFramework.Mvvm;assembly=MvvmFramework"

In this case referenced assembly is MvvmFramework.dll