开发者

Can I stop a .Net BindingSource automatically navigating to a new record?

Using a BindingSource attached to an ObservableCollection I have a combobox displaying the items in the collecti开发者_运维百科on. Visual Studio automatically includes a BindingNavigator so I've enabled some features on that as well. Using the Add button to add a new item; the combobox automatically selects the new item. I assume this is because the BindingSource has updated it to reflect the fact that its current item has changed. My question is; can I stop the bindingsource automatically navigating to whatever I've just added and thus stop the combobox changing selection when I don't want it to? I don't want to hack either the combobox or the bindingsource to force it to maintain state, if I can avoid it.


I don't think you can avoid that behavior, if you want to use an automatic bindingsource i think you're stuck with it. If you try to find a hack to resolve this issue, you're probably gonna run into even bigger issues. My solution would be to bind the combobox manually, and just use the automatic binding on whatever control you're using to actually add and modify the data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜