WPF databinding update comboxbox2 based on selection change in combobox1 with MVVM

Posted by cody on Stack Overflow See other posts from Stack Overflow or by cody
Published on 2010-05-19T23:57:01Z Indexed on 2010/05/20 0:00 UTC
Read the original article Hit count: 371

Filed under:
|
|

I have a combo box that I have bound to a list that exists in my viewmodel. Now when a users makes a selection in that combo box I want a second combo box to update its content.

So, for example, combobox1 is States and combobox2 should contain only the Zipcodes of that state.

But in my case I don't have a predefined lists before hand for combobox2, I need to go fetch from a db.

Also, if needed, I could get all the potential values for combobox2 (for each combobox1 value) before hand, but I'd like to avoiding that if I can.

How do I implement in WPF and using MVVM? I'm fairly new to this whole wpf\databinding\mvvm world.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm