1-我有一个数据类:
public class Data
{
public static List<Employee> Employees = new List<Employee>
{
new Employee {EmployeeID=1, FirstName="Garth", LastName="Schulte", Position="Trainer"},
new Employee {EmployeeID=2, FirstName="James", LastName="Conrad" ,Position="Trainer"}
};
}
2- 在 MainWindow.xmal.cs
private void GetEmployeeListQuery()
{
dynamic emps = from emp in Data.Employees
select emp;
lbEmployees.DataContext = emps;
}
读取选择 emp 时出现错误:
XamlParseException occurred
'对与指定绑定约束匹配的'WpfApplication1.MainWindow'类型的构造函数的调用引发了异常。行号“3”和行位置“5”。
请给我提意见