tags:

views:

41

answers:

1

when i bind one combobox with other combobox items... with the following code

 <ComboBox ItemsSource="{Binding ElementName=cbo1, Path=Items}" Name="cbo2"  />

it works fine but when i select something from cbo1 and come back to select something in cbo2.. it doesn't list anything nor cbo1 does...

what could be wrong?

A: 

The Items property is a CollectionView which wraps the ItemsSource, and includes things like the currently selected item, sort order, etc. If you set ItemsSource on an ItemsControl, your data is automatically wrapped in a CollectionView, and that's what gets set as the Items property. I suspect that this class isn't suitable for sharing between two controls.

If you're using ItemsSource to set the data on cbo1, you could maybe bind to ItemsSource instead? That is:

<ComboBox ItemsSource="{Binding ElementName=cbo1, Path=ItemsSource}" Name="cbo2"  />

Haven't had chance to test this, but it's an educated guess :-)

Dan Puzey