我在wpf中遇到DataGrid问题
这是一堂课:
class Superviser
{
public long Id = 0;
public string name = "";
public string father = "";
public string code = "";
}
这是一个构建此类对象列表的函数
public List<Superviser> allSuperviser()
{
return db.tbPersons.Where(i => i.level == StaticsObject.isSuperviser).Select(x => new Superviser
{
Id = x.Id,
name = x.firstName,
father = x.father,
code = x.code,
}).ToList();
}
并且我使用此代码在datagrid中设置此列表
dgvPerson.ItemsSource = classPerson.allSuperviser();
但是当运行程序datagrid为空时!
tip:列表不为空。
问题出在哪里?
如何在DataGrid上显示此列表?
答案 0 :(得分:1)
你好我已经解决了
我将课程更改为:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
并将功能更改为:
class Superviser
{
public long Id { get; set; }
public string name { get; set; }
public string father { get; set; }
public string code { get; set; }
public Superviser() { }
public Superviser(long Id, string name, string father, string code)
{
this.Id = Id;
this.name = name;
this.father = father;
this.code = code;
}
}
问题已解决:)