我DataGrid
以这种方式显示数据:
var display = (from r in ve.Folders.Include("Hosting_Company1")
select new RepoClass{ id = r.Folder_Id,name= r.Full_Name, hosName= r.Hosting_Company1.Housing_Name }).ToList();
dg1.ItemsSource = display;
并在XAML
:
<DataGrid CanUserAddRows="False" AutoGenerateColumns="False" Name="dg1">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=id, Mode=TwoWay}" Header="id"/>
<DataGridTextColumn Binding="{Binding Path=name, Mode=TwoWay}" Header="Name" />
<DataGridTextColumn Binding="{Binding Path=hosName, Mode= TwoWay}" Header="company" />
</DataGrid.Columns>
</DataGrid>
然后我如何将数据更新到EF
?