how to fill combo box in silverlight from database
i have a silverlight application.In this i have used service file for DML operations.The methods in Service can be accesed in form page.ie the the XAML page(example Main.XAML) MY issue is i cant access my DB in the XAML pages as it is in silverlight,i want to create a method in Service file,get some data from MAster tables and fill it in the combo boxes which are 开发者_如何学Cthere in my first form. Im trying to use System.Windows.Forms.ComboBox combobox as a control as i cant access the controls of my forms in the service file and then trying to use this control in my form(Main.xaml)then it is showing an error.
Can anyone please let me know how can i populate data this way in combo box. Rply as early as posible.
You'll need to add an operation to your service that returns a collection of data contracts (for instance a collection of products).
Then call the service from your SL application using an asynchronous call and bind the data to the combo box in the async callback.
There's a working example here.
精彩评论