Old forum URL: forums.lhotka.net/forums/t/9533.aspx

TerryH posted on Monday, September 13, 2010

Having gone through Rocky's MVVM video series, creating a test solution, I'm unsure how to populate a combobox with a list of items. The viewmodel class is created with a type which is a business object, but the list of a combobox isn't a part of that business object. The usercontol (View) uses a collectionviewsource, I have tried putting mutplie collectionviewsources on a View, but the only collectionviewsource that gets populated is the one that is passed with the call to showview. Could someone explain how I should have the second collectionviewsource populated, or maybe how to structure the viewmodel so that the combobox on the view can get populated with a section list.

An example if someone has one would be great.

ajj3085 replied on Monday, September 13, 2010

Add a property to your VM which contains the list of items in the to put in the combobox.  Then, create a command based object which will retreive the BO you're editing as well as a ROLB or NVL of these items, and use that command object to fetch both the list and BO at once.  Then just wire up the results when the VM is refreshed.

Copyright (c) Marimer LLC