【问题标题】:WPF class not found in XAML在 XAML 中找不到 WPF 类
【发布时间】:2012-04-22 02:22:15
【问题描述】:

我正在尝试为要在 XAML 中使用的类创建一个密钥,但 Visual Studio 11 说不存在这样的类。

步骤:

我在我的程序命名空间中创建了一个类:

namespace Test {
    public class PointCollectionConverter : System.Windows.Data.IValueConverter....

我在 MainWindow.xaml 中添加了一个本地命名空间引用

xmlns:local="clr-namespace:GeometryTest"

我尝试将类添加为资源:

<Window.Resources>
      <local:PointCollectionConverter x:Key="pointCollectionConverter"/>
</Window.Resources>

重新编译后修复。

【问题讨论】:

标签: c# wpf xaml


【解决方案1】:

命名空间是Test,而你使用GeometryTest?有点不对劲。

怎么样:

xmlns:local="clr-namespace:Test"

【讨论】:

  • 我在这里更改了命名空间以便于阅读。原来我只需要重新编译它。但无论如何你的答案是正确的:P
  • @StanislavPalatnik:人们似乎过于信任他们的 IDE; a recent example.
猜你喜欢
  • 1970-01-01
  • 2019-02-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-01
  • 1970-01-01
  • 2019-03-04
相关资源
最近更新 更多