【发布时间】:2012-05-11 11:01:51
【问题描述】:
我有点厌倦了必须在每个 xaml 文件中声明一个 xmlns 并且不得不为我的自定义控件使用前缀。是否可以将 clr 命名空间映射到“http://schemas.microsoft.com/winfx/2006/xaml/presentation”?
我在 AssemblyInfo.cs 中尝试了以下内容:
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation","MyOwnNamespace")]
但这似乎不起作用。我仍然收到如下编译错误:
XML 命名空间“http://schemas.microsoft.com/winfx/2006/xaml/presentation”中不存在标记“MyCustomControl”。
注意:我的控件在同一个程序集中(我有一个程序集)。
【问题讨论】: