silverlight - MVVM light datagrid loading from two relational database tables -


How do I load the DataGrid with two related tables using MVVM light, I use the .net RIA and Silver I am doing 4.

For example, if I have my data tables:

userInfo-userID, name, address ID
address - address ID, street name, zip

How do I create a dotgrid [name, street name, zip]

Firstly you must include the address table below GetQuery of UserInfo in your DomainService class ...

  [query] Public IQueryable & lt; UserInfo & gt; GetUserInfos () {return.ObjectContext.UserInfos.Include ("Address"); }  

Then in the Metadata file you [include] above the bus

  [Include] Include the public address address {get; Set; } Public IntadId {Receipt; Set; }  

Create a solution now Now in Xaml you can type

  & lt; Sdk: DataGrid ItemsSource = "{Binding UserList, Mode = TwoWay}" can be used by "SelectedItem =" {CurrentUser, Mode = TwoWay} "Margin =" 0,0,0,2 "Autogrentech column =" Wrong "& gt; SDK: DataGrid.Columns & gt; & lt; sdk: DataGridTextColumn header =" name "binding =" {binding path = name} "/> & lt; sdk: DataGridTextColumn header =" Road name "binding =" {binding path = address} Path name} "/> & lt; sdk: DataGridTextColumn header =" zip "binding =" {binding path = address. Zip} "/> 
SDK: DataGrid.Columns>

Comments