Reputation: 526
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" />
Upvotes: 5
Views: 4109
Reputation: 526
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
Upvotes: 2
Reputation: 3498
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
Upvotes: 0
Reputation: 1394
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>
Upvotes: 0