views:

158

answers:

0

Hello All!

I have a question very similar to this gent in this post
http://stackoverflow.com/questions/1864567/wcf-ria-services-loading-data-and-binding in
which the poster was trying to figure out how to use ria to bind to something other than the common scenrios overviewed in the numerous online examples (ie bind to an item source of a grid or list box)

My specific question is how or if i can bind a ria entity (which really represents a row in my datastore via EF or LINQ to SQL) to a custom form (or stackpanle or whatever) so that i can edit it and preserve the two-way data binding and data annotations.

for example i would like to

  • create a data model using LINQ
  • expose a getCustomerByID method using a domain service
  • return the single result of getCustomerByID to the silverlight client
  • bind that entity to a silverlight controls datacontext property
  • automate change tracking when someone edits the form
  • be able to push the edits back into the data store by simply calling save on the context

basically the same thing that the various demos do with a datagrid and dataform. i think the main thing im not grasping is how to extract the returned entity from the response and use it in a manner that makes sense. (like bind to a custom control) all the examples i have seen rely on a automatic binding from the xaml or setting an entire collection to a item source property.

something like this but only extract a single value and bind to a datacontext not an item source

RIAContext service = new RIAContext(); service.Load(service.GetEmployeesQuery()); grd1.ItemsSource = service.Employees;