Aim: to access cells from a datagrid selected row. where the datacontext of the datagrid is a Linqtosql Query_result (i.e. not a well defined structure):
note: Query is across 3 Tables
displayed wpf form shows datagrid colums as follows:
| ftid | ftName | ftcft_id | ftcc_Id | ClassMaxVol |
var queryR = from ft in dc.FluidTypes
from ftc in dc.FluidTypeClasses
from c in dc.Classes
where (ft.Id == ftc.FluidType_Id) &&
(ftc.Class_Id == c.Id)
select new { ft_id = ft.Id, ft_Name = ft.Name,
ftc_ft_id = ftc.FluidType_Id,
ftc_c_Id = ftc.Class_Id,
Class_MaxVol = c.MaxVolume };
DataGridR.DataContext = dc;
DataGridR.ItemsSource = null;
DataGridR.ItemsSource = queryR;
[<DataGrid x:Name="DataGridR">
<!-- Set data contect to dc-->
<!-- Set item source to query result relative to data context-->
</DataGrid>][1]
PS: Have reviewed many examples showing well defined DataGrids with known class definitions in DataContext,