Thursday, July 29, 2010

Combobox and DataForm in Silverlight 4

Working through the bits and pieces of binding expressions in Silverlight 4 is a lot of fun as long as you are following the tutorials. But what happens when you need to generate a real-world scenario? Wait, what??? Yes, you heard me. What happens when you actually have to port an example scenario to real life? It doesn't work. Well, unless you want to have a form of data with just textboxes...

PROBLEM:

When you put a combobox or series of comboboxes in a dataform, the load sequence gets all messed up and things stop working.

The Silverlight Dataform that is included in the Toolkit is actually a wonderful tool, but it brings its own set of limitations. Primarily, the fact that it is a control that can contain other controls is something that you can only truly appreciate if you have ever had to do your own recursive searching through parent controls to find other children.. but I digress.

SOLUTION:
Use the ComboBoxDataSource offered by Kyle McClellan here.
Seriously, it is a great solution for this problem. But you have to follow it closely.

No comments:

Post a Comment