0
我有一個匿名的linq查詢,我綁定到一個數據網格,當我調試它帶來好的數據,但它不顯示在數據網格中,我懷疑在將其綁定到數據網格之前,對RIA服務的請求未完成。我可以使用LoadOperation <>()完成的事件。但它只適用於定義實體,所以我該怎麼做? 僅供參考這裏的最後一個職位: LINQ query null reference exception 下面是該查詢:Silverlight的DataGrid不顯示任何數據與匿名查詢RIA服務
var bPermisos = from b in ruc.Permisos
where b.IdUsuario == SelCu.Id
select new {
Id=b.Id,
IdUsuario=b.IdUsuario,
IdPerfil=b.IdPerfil,
Estatus=b.Estatus,
Perfil=b.Cat_Perfil.Nombre,
Sis=b.Cat_Perfil.Cat_Sistema.Nombre
};
我是一個完全新手,對不起,如果是一個很簡單的問題。
謝謝!
在DomainService中還是在同一個xaml.cs中?我是否必須爲每個需要的匿名查詢創建每個類? – user289082 2010-03-10 15:59:38
您只需要爲需要綁定的對象創建類。您也可以使用ValueConverter和ConverterParamter通過反射來提取屬性值。 – 2010-03-10 19:41:56
= S我對反射一無所知可以寫一個片段,因爲我可以更好地理解它。謝謝! – user289082 2010-03-11 15:56:46