在WPF应用程序中保存Combox控件的状态 [英] Save state of Combox control in WPF application

查看:70
本文介绍了在WPF应用程序中保存Combox控件的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将组合框控件的状态保存在我的WPF应用程序中,以便下次打开应用程序时,我应该看到组合框的最后一个选定值.
如何保存状态?:confused:

I want to save the state of the combo box control in my WPF application so that next time when i open the application i should see the last selected value of the combobox.
How to save the state?:confused:

推荐答案

这些可能会帮助您...

http://blogs.microsoft.co. il/blogs/tomershamam/archive/2007/06/08/WPF-Control-State-Persistency.aspx [ WPF控制状态持久性 [
These might help...

http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/06/08/WPF-Control-State-Persistency.aspx[^]
WPF Control State Persistency[^]


在这种情况下,您可以通过创建注册表来保存组合框的状态在您的计算机上.保存其注册表值及其状态值,并在需要时检索它!

例如,我已经使用此技术来获取最后选择的路径,以便下次用户可以直接转到OpenDialog框中的文件夹路径.

以下是创建注册表的一些链接:

http://www.c-sharpcorner.com/uploadfile/sushmita_kumari/registrykeys102082006061720am/registrykeys1.aspx /a> [ ^ ]

http://msdn.microsoft.com/zh-我们/library/microsoft.win32.registrykey%28v=vs.71%29.aspx [
Well in that case you can save the state of combobox by creating a registry on your computer for it. Save its registry value with that of its state and retrieve it when needed!

For example,I have used this technique for getting the last selected path so that next time the user can go straight to the folder path in the OpenDialog box.

Here are few links to create registries:

http://www.c-sharpcorner.com/uploadfile/sushmita_kumari/registrykeys102082006061720am/registrykeys1.aspx[^]

http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey%28v=vs.71%29.aspx[^]


这篇关于在WPF应用程序中保存Combox控件的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆