When the UltraCombo.DataSource is set to a Forms.BindingSource, and the members of the BindingSource.DataSource are Entity Framework Entities, UltraCombo row selections by the user do not change the BindingSource.Position, BindingSource.Current or BindingSource.CurrentItem values. In fact, if you create BindingSource event handlers for CurrentItemChanged(), CurrentChanged() and PositionChanged(), you can see that UltraCombo row selections do not even cause those BindingSource events to fire. This causes the UltraCombo and its respective BindingSource to be continuously out of sync.
I might also mention that I have experienced this when I assign the BindingSource.DataSource either an array of EF Entities or a Collections.Generic.List of EF Entities.
Hi,
It does not make any difference that data source you use, the UltraCombo does not position the BindingManager by default.
The inbox ComboBox does this, but I've always felt this is a pretty weird thing to do, because a ComboBox can be used for a lot of different functions and only one of them make sense to synch up the BindingManager position.
Anyway, all you have to do is set SynchWithCurrencyManager to true.
That's a strange default value for SynchWithCurrencyManager, but yes, setting it to true does cause the BindingSource.Position to keep up with the UltraCombo row selection. (You just know there's a 'but' coming...)
However, I originally thought that a different problem that I was having was caused by the out-of-sync UltraCombo / BindingSource. So that others can follow that phenomenon, I'll make a new forum entry titled, "WinCombo Row Selection Causes Entity Update".
By the way, Mike, I've scoured these forums for years and, until now, never needed personal assistance. I must have read hundreds of posts. I am personally angered when I read some pathetic punk spewing dribble about your incompetence, or lack of motivation, or intentional "cryptic" response, or... They are only showing their ignorance because your responses are by far the most thorough, helpful, well researched, knowledgeable, concise and correct resolutions to the issues posted. Keep up the good work and ignore the guru-wannabes.
mduff said:That's a strange default value for SynchWithCurrencyManager, but yes, setting it to true does cause the BindingSource.Position to keep up with the UltraCombo row selection. (You just know there's a 'but' coming...)
If you ask me (and you didn't), I think the the MS ComboBox default behavior is strange.
There are basically two functions that a ComboBox serves in an application. One is to choose a value from a list. So, for example, you have a customer address in a database, and you have a State field. When the user drops down the list and chooses a State like New York, you are updating the address of the current record.
The other function of a combo is to choose a record. So, for example, you drop down a list of names in the Combo and pick one, and then rest of the user interface is updated with information associated with that customer.
In the second case, it makes sense for the combo to adjust the position of the CurrencyManager. But in the first case, it does not.
I could be wrong, but I think the first case is a lot more common. Most applications use a ComboBox to update data rather that as a navigation tool.
And changing the position of the CurrencyManager in the first case is not only weird, it can also cause problems, because if you pick an item from the list and you are not aware that the CurrencyManager position is being updated, you could end messing up some other part of the application. In my example above with the States, suppose you have a list of States on the same form displaying in another combo? When you pick an item from one combo, it would update the other combo's position and set the Value. And unless you are really knowledgeable about DataBinding in DotNet, you would probably be pretty baffled about why it was happening or how to prevent it.
So we made the choice to default to not synching the position of the CurrencyManager because it's a lot less likely to cause problems and confusion. The only confusion this could possibly create is, of course, the one you ran into here. And that's very easily solved by just flipping a simple boolean property.