【发布时间】:2010-12-29 20:13:44
【问题描述】:
我在 AssemblyInfo.cs 中注册了一个程序集 XAML:
[assembly: XmlnsDefinition("http://schemas.mysite.es/wpf", "SWC.ViewModels")]
在我的命名空间中,我拥有这些类:
namespace SWC.ViewModels
{
public class MenuViewModel
: ObservableCollection<MenuViewModel>
{
public MenuViewModel()
: base()
{
}
}
}
如果我在用户控件 XAML 中使用命名空间,
<UserControl x:Class="SWC.UserControls.UserMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:customMenu="http://schemas.mysite.es/wpf">
我可以在我的 XMLNS 命名空间中使用该类,
<UserControl.Resources>
<customMenu:MenuViewModel x:Key="MenuItemsSource">
但是,当我执行应用程序时,编译器说
The label 'MenuViewModel' dosen't exist in the namespace XML 'http://schemas.mysite.es/wpf'
所有,可以帮助我吗?我被这个问题疯了!! 最好的问候,
【问题讨论】:
-
欢迎来到 Stack Overflow!格式化提示:要获取代码块,请在每行前加上四个空格,或单击
{}按钮。
标签: c# wpf xaml programming-languages