locked
Data Form With Combo Boxes and Entity Item Source RRS feed

  • Question

  • HiAll,

    I'm working on a system using the Entity Framework where I'm getting a record from the database via RIA Services and setting that as the current item on a data form. My question is that the data form will have combo boxes on it which I want to be filled from a lookups table I have in the database. I have no trouble getting the data out of the database but I was wondering on the best way to set the item source of the combo boxes i.e. Since my data form is on a user control should I bind the item source to a property I create on the user control and if I do this can I still have the binding to the actual object I'm updating. Or can you do something with the EF to bring the list of available values through with the record? Any links to examples etc. would be great thanks.

    I've done some Google searches on this but couldn't find anything matching this and I would have thought it’s a fairly common scenario.

     

    Wednesday, September 21, 2011 6:15 AM

Answers

  • Hi,

    Since my data form is on a user control should I bind the item source to a property I create on the user control and if I do this can I still have the binding to the actual object I'm updating. Or can you do something with the EF to bring the list of available values through with the record?

    I suggest you choose the first one. Because all ComboBox ItemsSource bound data in one column are the same data, so it is not neccessary to return the same data associated with every record.

    Below is an article introducing how to add a class to return a list and bind it to ComboBox ItemsSource as StaticResource. Please have a try and let me know if you have any further questions.

    http://weblogs.asp.net/manishdalal/archive/2009/07/03/silverlight-3-combobox-control.aspx

     

    Best Regards,

     

     

    Tuesday, September 27, 2011 5:34 AM