Reputation: 811
I am new to WPF:
I have a combobox whose ItemsSource is changing. This is not being reflected back to the user. Do i have to specify the ItemsSource Mode to TwoWay?
Any Suggessions?
<ComboBox Height="Auto" Name="comboBoxQuery" Width="300" IsEditable="True" ItemsSource="{Binding QueryNames, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" SelectedItem="{Binding SelectedQueryNames, Mode=TwoWay}" SelectedValuePath="Key" DisplayMemberPath="Value" Visibility="Collapsed" /> <!--Is this correct? -->
Upvotes: 0
Views: 81
Reputation: 5935
In order to tell the view that collection source was changed, you should use collection classes which supports INotifyCollectionChanged interface. For example: ObservableCollection, BindingList. You do not need TwoWay data binding, WPF will detect that source collection supports INotifyCollectionChanged interface, and all changes you made in that collection will reflect the view.
Upvotes: 3