Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly Alias in XAML

Tags:

.net

wpf

xaml

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" />
like image 693
Avani Vadera Avatar asked Nov 05 '22 04:11

Avani Vadera


1 Answers

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

like image 172
Avani Vadera Avatar answered Nov 11 '22 15:11

Avani Vadera