在 XAML 中找不到 WPF 类

本文关键字:WPF 找不到 XAML | 更新日期: 2023-09-27 18:31:57

我正在尝试为类创建一个要在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>

重新编译后修复。

在 XAML 中找不到 WPF 类

命名空间

Test,你使用GeometryTest ?这里有些不对劲。

怎么样:

xmlns:local="clr-namespace:Test"