我有一个大问题。我尝试将我的 WPF 绑定DataGrid
到使用内部联接创建的表。我为信息创建了一个类以成功转换:
public class NeshtoSi
{
public NeshtoSi() { }
public string ssn;
public string name;
public string surname;
}
然后我创建了内连接表。仍然当我分配所有值时ItemsSource
,所有值都被正确传输,但DataGrid
并没有将它们可视化。
var dd = from d in dataContext.Medical_Examinations
join p in dataContext.Patients on d.SSN equals p.SSN
select new NeshtoSi { ssn = d.SSN, name = p.Name, surname = p.Surname };
IQueryable<NeshtoSi> sQuery = dd;
if (!string.IsNullOrEmpty(serName.Text))
sQuery = sQuery.Where(x => x.name.Contains(serName.Text));
if (!string.IsNullOrEmpty(serSurame.Text))
sQuery = sQuery.Where(x => x.surname.Contains(serSurame.Text));
if (!string.IsNullOrEmpty(serSSN.Text))
sQuery = sQuery.Where(x => x.ssn.Contains(serSSN.Text));
var results = sQuery.ToList();
AnSearch.ItemsSource = sQuery;
我希望有人可以帮助我...