【发布时间】:2014-09-07 03:47:11
【问题描述】:
我的 xaml 是这样的:
<DataGrid.Resources>
<Helpers:EnumHelper x:Key="EnumHelper" />
</DataGrid.Resources>
我的班级是这样定义的:
namespace MyProj.View.UserControlHelpers {
public class EnumHelper { }
}
我得到的错误是这样的:
命名空间“clr-namespace:MyProj.View.UserControlHelpers”中不存在名称“EnumHelper”。
我已经从工作室清理了这个项目,然后我删除了 bin 和 obj 子目录中的每个文件,我什至更改了类名,但仍然没有成功 - 我仍然收到此错误。
编辑:
我的 xaml 标头是这样的:
<UserControl x:Class="MyProj.View.Partials.TableWindow.Columns"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="http://www.galasoft.ch/mvvmlight"
xmlns:Helpers="clr-namespace:MyProj.View.UserControlHelpers"
xmlns:Model="clr-namespace:MyProj.Model"
xmlns:ModelHelpers="clr-namespace:MyProj.Model.Helpers"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
【问题讨论】:
-
我不明白。你想让我做什么?
-
显示您的 XAML 标头,其中包含描述 XML 命名空间和导入的 CLR 命名空间的所有属性。
-
@Athari - 我编辑了我的问题
-
您何时收到错误消息?如果您在编辑器中创作 XAML 时得到它,而不是编译您的项目,请尝试(重新)构建。