简体   繁体   English

保存复选框/文本框状态的更好方法是什么? 将这些保存在“ .settings”文件中更好吗?

[英]What is the better way to save state of checkboxes/textboxes? Saving these in “.settings” file is better?

I want to save state of lot of CheckBoxes (checked/unchecked) and some TextBoxes on a WPF screen in .settings file (As I do not want to use database/filing). 我想在.settings文件中的WPF屏幕上保存很多CheckBoxes (选中/未选中)和一些TextBoxes状态(因为我不想使用数据库/归档)。

Whether I have to save all these checkboxes and textboxes in setings file or there is a better way to do it? 我是否必须将所有这些复选框和文本框保存在设置文件中,还是有更好的方法呢?

If this is to remember the state of controls in an application, I would definitely use user settings to store this. 如果要记住应用程序中控件的状态,我肯定会使用用户设置来存储它。 Creating a separate setting for each control can be time consuming initially, but it makes life a little easier later. 最初为每个控件创建单独的设置可能很耗时,但以后会使生活变得更轻松。 However, if you don't want to do this, you can simply create a custom settings class with a public property for each control and then simply use an instance of that class as your one savable setting. 但是,如果您不想这样做,则可以简单地为每个控件创建一个具有公共属性的自定义设置类,然后仅将该类的实例用作您的一个可设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM