How to keep two Combo Boxes in sync with WPF [modified]
-
Hi I have a four combo boxes, along with one text box and all 5 controls. The principle is that if the user selects an item from the first combo box, this selected item then gets reflected in the text box and the four other combo boxes. Whilst this action is working, if the user then selects a new item from the first combo box, say the next item down in the list, the new item is not showing in the other controls. The previous item is still there and hasn't been refreshed. Checking the class object, when first used, the object is being set with the value, but when selecting a new value from the combo box, this new value is not being passed on or up dates the object. I am using INotifyPropertyChanged! I have set IsSyncronizeWithCurrentItem ="true" on all of the combo boxes, but this isn't working. How do you very simply, keep all these controls in sync? Code is being built using MVVM design pattern.
modified on Monday, June 27, 2011 3:53 PM
-
Hi I have a four combo boxes, along with one text box and all 5 controls. The principle is that if the user selects an item from the first combo box, this selected item then gets reflected in the text box and the four other combo boxes. Whilst this action is working, if the user then selects a new item from the first combo box, say the next item down in the list, the new item is not showing in the other controls. The previous item is still there and hasn't been refreshed. Checking the class object, when first used, the object is being set with the value, but when selecting a new value from the combo box, this new value is not being passed on or up dates the object. I am using INotifyPropertyChanged! I have set IsSyncronizeWithCurrentItem ="true" on all of the combo boxes, but this isn't working. How do you very simply, keep all these controls in sync? Code is being built using MVVM design pattern.
modified on Monday, June 27, 2011 3:53 PM
IsSynchronizedWithCurrentItem does work. I've used it myself. I won't ask why you have 4 ComboBoxes and a TextBox all showing the same exact info :), but if its not working, you're likely doing something wrong, so post your code.
-
Hi I have a four combo boxes, along with one text box and all 5 controls. The principle is that if the user selects an item from the first combo box, this selected item then gets reflected in the text box and the four other combo boxes. Whilst this action is working, if the user then selects a new item from the first combo box, say the next item down in the list, the new item is not showing in the other controls. The previous item is still there and hasn't been refreshed. Checking the class object, when first used, the object is being set with the value, but when selecting a new value from the combo box, this new value is not being passed on or up dates the object. I am using INotifyPropertyChanged! I have set IsSyncronizeWithCurrentItem ="true" on all of the combo boxes, but this isn't working. How do you very simply, keep all these controls in sync? Code is being built using MVVM design pattern.
modified on Monday, June 27, 2011 3:53 PM
Check that the binding of the selecteditem in the combobox is
Mode="TwoWay"
.Never underestimate the power of human stupidity RAH