WPF Simplified Series
October 11, 2009 2 Comments
In this series I’ll take a look at some of the major concepts in WPF. If you’ve been coding using WinForms, WPF can be a little confusing because it brings with it a lot of new constructs, like XAML. It is also a more powerful platform than WinForms, incorporating 2D & 3D drawing, advanced typography, animation, advanced data binding, and many others.
WPF Simplified Part 2: Triggers
WPF Simplified Part 3: Dependency Properties
WPF Simplified Part 4: Logical and Visual Trees
WPF Simplified Part 5: Control Templates
WPF Simplified Part 6: Attached Properties
WPF Simplified Part 7: Routed Events
WPF Simplified Part 8: Data Templates
WPF Simplified Part 9: Logical Resources
WPF Simplified Part 10: WPF Framework Class Hierarchy
WPF Simplified Part 11: XAML Tricks
WPF Simplified Part 12: Adorners
WPF Simplified Part 13: Value Converters
WPF Simplified Part 14: INotifyPropertyChanged and ObservableCollection
WPF Simplified Part 15: Data Validation
Coming soon…
WPF Simplified Part 16: Skins
WPF Simplified Part 17: Commands
WPF Simplified Part 18: MVVM
WPF Simplified Part 19: Data Binding
Well organised, simple and no fuss explanations, navigation super. Well done.
Can I ask you something? I have a ListBox and a ComboBox with the itemsSource for each set to a different CollectionView of the same CustomerCollection. CustomerCollection is an ObservableCollection of Customer objects. Customer is a Linq to SQL entity class so it implements INotifyPropertyChanged. I also have a totally different Customer object that I add to the ListBox CollectionView using AddNewItem and CommitNew. The ComboBox dropdown list updates automatically to show the new item.
So far so good. Now the problem.
I want to replace one of the CustomerCollection objects. I have a totally separate Customer object and I want to change the properties of the CustomerCollection object that has the same CustomerID, to match the properties of the separate Customer object. First I want to change the ListBox CollectionView, and I also want the changes to show automatically in the ComboBox dropdown list, just as they did when I added a new Customer to the CustomerCollection via the Collection view for the ListBox.
Is there a way to do this? I tried removing the corresponding Customer object from the ListBox CollectionView, and then adding it again, and this works perfectly EXCEPT when that object was selected in the ComboBox. The ComboBox then display the wrong value.