提交应用程序设置更改
我将用户设置绑定到 WinForm 对话框上的一堆控件有确定/取消按钮。虽然这对于读取绑定非常有用,但我只想在用户单击“确定”时提交绑定更改,而不是在单击“取消”时提交绑定更改。是否有一个简单的设置来实现这一目标,而不是管理所有阅读并致力于自己?
现在,假设我有一个文本框绑定到名为“国家/地区”的用户设置。其中包含“United States”,如果用户将其更改为“Bolivia”,则在键入后立即提交,而不是在按下“确定”按钮时提交。
I'm binding user settings to a bunch of controls on a WinForm dialog that has OK/Cancel buttons. While this works great to read in the bindings in, I would only like to commit binding changes if a user clicks OK, and not if they click cancel. Is there a simplistic setting to achieve this rather than managing all reading and committing myself?
Right now, let's say I have a textbox that binds to a user setting called "country". It has "United States" in it and if a user changes it to "Bolivia", that will get committed as soon as it is typed instead of when the OK button is pressed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要保存设置,请添加“确定”按钮事件处理程序:
要重新加载设置:
祝你好运!
To save settings, add in the ok button event handler:
To reload the settings:
Good luck!