2014-09-06 28 views
0

我的XAML是這樣的: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頭是LIK此:

<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"> 
+1

展xmlns attr – Athari 2014-09-06 19:36:59

+0

我這樣做不明白。你想要我做什麼? – 2014-09-06 19:38:11

+0

使用描述XML名稱空間和導入的CLR名稱空間的所有屬性顯示您的XAML頭。 – Athari 2014-09-06 19:39:06

回答

4

您的類命名空間是

MadMin.View.UserControlHelpers 

,但你是指它在XAML爲

MyProj.View.UserControlHelpers 
+0

如問題的更新版本中所述,如果命名空間名稱始終相同,如何解決此問題? – 2014-09-06 20:09:54

+0

實際上,命名空間名稱不一樣 - 在一臺計算機上(此代碼工作的地方) - 它們是相同的,而在另一臺計算機上(這不起作用),它們不是。 – 2014-09-06 21:34:44