大会别名在XAML [英] Assembly Alias in XAML

查看:204
本文介绍了大会别名在XAML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经使用WPFToolKit和presentationFramework 4.0在我们的项目。有在这两个动态链接库(组件)一些常见的命名空间。要解决这个名字空间的冲突,我们提供了一个别名WPFToolKit,在后面的code(的.cs文件)

这帮助

现在我们的XAML文件,我们如何指定别名。

WPFToolKit DataGrid中无法识别

错误: 类型或命名空间名称'控制'不命名空间中存在'Microsoft.Windows(是否缺少程序集引用?)

XAML命名空间code

 的xmlns:WpfToolkit =CLR的命名空间:Microsoft.Windows.Controls;装配= WPFToolkit
 

XAML的DataGrid

 < WpfToolkit:DataGrid的名称=BlotterGrid/>
 

解决方案

构建误差得到了通过使用别名为全球性的,MyAlias​​,而不是MyAlias​​解决。 因此,在code文件外部别名MyAlias​​在XAML全球使用,而被使用。

参考: <一href="http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/87f0caa0-c57a-4146-a999-c794947ae28e" rel="nofollow">http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/87f0caa0-c57a-4146-a999-c794947ae28e

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" />

解决方案

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

这篇关于大会别名在XAML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆