Data that updates other user controls in WPF
I currently have two user controls that both utilize a list of objects. These lists of objects are coffee types. These 2 user controls show the coffee types in different ways.
What I want to do is, when a coffee type is selected in one user control, it will update or highlight the same coffee type selected in the other user control.
I tried making an ObservableCollection
that both user controls would l开发者_JS百科ook at, but it did not work out.
Any other ideas?
Thanks!
The droids you are looking for: Selector.IsSynchronizedWithCurrentItem
You can set the IsSynchronizedWithCurrentItem property to true to ensure that the item selected always corresponds to the CurrentItem property in the ItemCollection. For example, suppose that there are two ListBox controls with their ItemsSource property set to the same source. Set IsSynchronizedWithCurrentItem to true on both list boxes to ensure that the selected item in each ListBox is the same.
精彩评论