如何更新用户在UI中更改的资源字符串?(How can I update a resource string that has been changed in the UI by the user?)

编程入门 行业动态 更新时间:2024-10-24 22:25:30
如何更新用户在UI中更改的资源字符串?(How can I update a resource string that has been changed in the UI by the user?)

我编写了一个简单的C#WPF项目,将数据读入数据网格,然后以CSV格式输出网格内容。 到目前为止,一切正常。

但是,我希望用户可以更改导出位置的文件路径,我也可以这样做,然后“存储”。

我已将默认位置设置为资源中的字符串并可以访问它,但是如果用户更改了资源字符串,我不知道如何更新资源字符串。

FilePath = ExportBonusToCSV_v1.Properties.Resources.ExportPath; MessageBox.Show(FilePath);

可以这样做还是有更好的方法?

I have written a simple C# WPF project to read data into a datagrid and then output the contents of grid as a CSV. This all works fine, so far.

However, I want the file path of the export location to be changed by the user, which again I can do, and then "stored".

I have set the default location a string in resources and can access it, but I do not know how to update the resource string if the users changes it.

FilePath = ExportBonusToCSV_v1.Properties.Resources.ExportPath; MessageBox.Show(FilePath);

Can this be done or is there a better way?

最满意答案

您可以使用独立存储来保留用户设置。

如果您不知道这是什么,以下内容可能会帮助您入门:

“它是什么?” - 在InformIT上输入文章 MSDN文档

You can use Isolated Storage to persist user settings.

In case that you don't know what that is, the following might help you get started:

"What is it?"-type article on InformIT MSDN documentation

更多推荐

本文发布于:2023-07-26 02:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269935.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   用户   资源   UI   update

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!