ComboBox WPF Databinding to a DataView
Posted
by
Oleg
on Stack Overflow
See other posts from Stack Overflow
or by Oleg
Published on 2011-03-08T16:06:32Z
Indexed on
2011/03/08
16:10 UTC
Read the original article
Hit count: 265
Hello Everyone!
Lets say I have one ComboBox and 2 TextBox items on my GUI. And I have one DataView with data (City, PostalCode, Street, ID). While initializing the whole thing I fill my DataView with some data :)
City 1, 11111, Street 1, 1 City 1, 22222, Street 2, 2 City 1, 33333, Street 3, 3
Now I want to bind this to my ComboBox. DataView is a Class Member called "m_dvAdresses", but this code doesnt help:
ItemsSource="{Binding Source=m_dvAdresses}" SelectedValuePath="ID" DisplayMemberPath="Street">
Also I want to have my 2 ComboBox items to show PostalCode and City, depending on what to i pick in my ComboBox. Like if I pick "Street 2", TextBox1 show me "City 1" and TexBox2 show me "22222"...
How can I bind all of them ONLY in the WPF code?
Thanks for help!!!!!!!!!!! :)
© Stack Overflow or respective owner