tags:

views:

122

answers:

2

A very basic question : I want to bind a wpf combobox to a selected element, so it displays the same value as the textbox :

    <StackPanel DataContext="{Binding ElementName=comboBox1, Path=SelectedItem}">        
    <TextBox Text="{Binding Path=Id}"></TextBox>
    <ComboBox ....

When changing the value of combobox1, the id of the selected item shows in the textbox. How do I bind a second combobox to the selected item in the first combobox to show the same value?

UPDATE : WPF ComboBox…how to set the .Text property? solved it for me : I needed the possibility to add items other than known beforehand, so the IsEditable property should have been true.

A: 

Looks ok to me. Maybe you should post a more complete examole. Do you have Selector.IsSynchronizedWithCurrentItem set on the combobox?

bitbonk
A: 

WPF ComboBox…how to set the .Text property? solved it for me : I needed the possibility to add items other than known beforehand, so the IsEditable property should have been true.

Peter