C# 为什么我会得到;类型引用找不到公共类型“;关于这个数据绑定?

C# 为什么我会得到;类型引用找不到公共类型“;关于这个数据绑定?,c#,wpf,data-binding,C#,Wpf,Data Binding,为什么在本例中,ObjectDataProvider没有识别“local:Customer” 我打字的时候 “x:Type”是一个标记扩展,因此请将其用大括号括起来: ObjectType="{x:Type local:Customer}" 尝试添加名称空间作为类的前缀 using System.Collections.ObjectModel; namespace TestDataTemplate124 { public class Customer { pu

为什么在本例中,ObjectDataProvider没有识别“local:Customer”

我打字的时候

“x:Type”是一个标记扩展,因此请将其用大括号括起来:

ObjectType="{x:Type local:Customer}"

尝试添加名称空间作为类的前缀

using System.Collections.ObjectModel;

namespace TestDataTemplate124
{
    public class Customer
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int Age { get; set; }

        public static ObservableCollection<Customer> GetAllCustomers()
        {
            ObservableCollection<Customer> customers = new ObservableCollection<Customer>();
            customers.Add(new Customer() { FirstName = "Jim", LastName = "Smith", Age = 23 });
            customers.Add(new Customer() { FirstName = "John", LastName = "Jones", Age = 22 });
            customers.Add(new Customer() { FirstName = "Jay", LastName = "Anders", Age = 21 });
            return customers;
        }
    }
}
ObjectType="{x:Type local:Customer}"