I have a XamComboEditor in my XamDataGrid that I've successfully put different options into, and you can change options via the dropdown box, etc etc etc bottom line is that it works.
Unfortunately there is one problem that is really annoying, and I have not been able to find an answer scouring these forums. I have a default value that shows up, "Auto". You can change from this option, and the change stays. Switching back, "auto" then stays.
HOWEVER, from the initial default value "Auto", if you select the combo box as if to change it, but don't select anything... you can then click twice outside the box (one to cancel selection and then again to do something else such as select a record in the grid), "Auto" disappears!!!
In my code, I do not change the value of the currently selected item if the selection is "null", which is what happens in this situation. I'm calling the appropriate RaisePropertyChanged() method, yet the visual combobox still changes :(
Is there any way to stop this from happening? Even repeated calls to RaisePropertyChanged() do not fix this. And as I said, this is only on the very first initial value. Once you've changed the selection everything works as expected. Any thoughts?
Hello Ryan,
I have modified the sample you attached before, so it works as you want. Basically I set the BindingPath of the UnboundField to CurrentSelectedOption and set the SelectedItem’s Binding to be TwoWay.
Hey,
So I hate to dig this up again, but I've noticed a problem with the proposed solution. This actually came up when I was using this same XamComboEditor idea with a different GUI, only this time with a lot of combo boxes (fills the screen top to bottom). At first I forgot to set the ValuePath, but instead of the disappearing values as in the previously posted example, I instead was seeing values just not loading when scrolled into view. I could scroll up and down and different combo boxes would be filled with the appropriate value each time - some would have them and some would not, and every time I scrolled up and down which ones had the value in it would change!
I thought this was strange, but noticed that I didn't set the ValuePath. So I set it, and just like before now all of the values are displayed as expected! However, my program is now running as slow as a snail. I took a look at the output and I see this:
System.Windows.Data Error: 40 : BindingExpression path error: 'CurrentSelectedConversionOption' property not found on 'object' ''String' (HashCode=-2122594931)'. BindingExpression:Path=CurrentSelectedConversionOption; DataItem='String' (HashCode=-2122594931); target element is 'ComboBox' (Name='PART_FocusSite'); target property is 'NoTarget' (type 'Object')
I went back to my previous program and it also has this error! I remember ignoring the error before because it didn't seem to affect my program at all, and the disappearing values were fixed, so I didn't care. In this new program, though, I can't accept this as the solution, because the errors are slowing my program down.
What seems to be happening is that for some reason, the bindings for the combo box editor aren't always updated when you scroll through a large list of them (or when you click off the value like in the previous program's example). When you set the ValuePath, however, it forces the bindings to try and update, which they do (hence why it fixes the problem), but because ValuePath isn't set to a correct value (after reading more on ValuePath, 'CurrentSelectedConversionOption' should not be correct because it's not a property of 'string') we get the error.
Is there an appropriate value to set ValuePath to that won't cause this error? I've tried wrapping up 'string' into a class, but not only is that hacky it also didn't work haha... I could have been doing something wrong though. In general though, it seems like the control should work as expected without having to set ValuePath, so something else is probably wrong...
Any ideas? Much appreciated,
-Ryan-
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Ahhh I understand, thank you! I'm sorry I had to bug you about this, but I had no idea I needed to set that property. I'm even more frustrated that I spent so many hours trying to fix this haha. Its always something small... oh well. Thanks again!
Cheers,
Hello,
I will be glad to explain you. Since the CellValuePresenter’s Value Property is bound to the Editor’s Value of the Cell and the XamComboEditor’s Value is determined by its ValuePath this Property should be set, so everything could work as expected. You can read more about ValuePath here:
http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=InfragisticsWPF4.Editors.v11.2~Infragistics.Windows.Editors.XamComboEditor~ValuePath.html
Hope this helps you.