我需要将2个数据从2个表中获取1个数据源
分数 用户身份 tribe_id score_mark
部落 tribe_id tribe_name
我需要score_mark和tribe_name,但是,到目前为止,我只能从Score对象获取score_mark,并从Tribe对象中获取相关的tribe_name
var scores_by_userID_query = from Score score in appDB.Scores where score.user_id.Equals(userID) select score;
ScoresByUserID = new ObservableCollection<Score>(scores_by_userID_query);
TribesByScore = new ObservableCollection<Tribe>();
if(ScoresByUserID != null)
{
foreach(Score score in ScoresByUserID)
{
var tribes_by_Score_query = from Tribe tribe in appDB.Tribes where tribe.tribe_id.Equals(score.tribe_id) select tribe;
Tribe tribe_obj = tribes_by_Score_query.FirstOrDefault();
TribesByScore.Add(tribe_obj);
}
}
但是,这是2个数据源。
我尝试创建一个新类并将属性加载到List中,但无法工作..如何将数据绑定到xaml中?
要阅读的任何来源吗?