Uwp 如何完全控制(读/写)自定义资源resw文件(通用Windows)
如何读取/写入自定义资源文件(resw)(存储字符串和条件资源)上的键/值 我添加了用于存储应用程序设置的资源文件(resw)。然后呢Uwp 如何完全控制(读/写)自定义资源resw文件(通用Windows),uwp,raspberry-pi3,uwp-xaml,windows-10-iot-core,resource-file,Uwp,Raspberry Pi3,Uwp Xaml,Windows 10 Iot Core,Resource File,如何读取/写入自定义资源文件(resw)(存储字符串和条件资源)上的键/值 我添加了用于存储应用程序设置的资源文件(resw)。然后呢 private void button1_Click(object sender, RoutedEventArgs e) { ResourceContext resourceContext = ResourceContext.GetForViewIndependentUse(); ResourceMap resource
private void button1_Click(object sender, RoutedEventArgs e)
{
ResourceContext resourceContext = ResourceContext.GetForViewIndependentUse();
ResourceMap resourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("Resources");//resources.resw accessing in root is ok.
var resourceValue = resourceMap.GetValue("PicPath", resourceContext);
resourceMap.SetValue("DBPath", resourceContext,"PicPath2");//no write avaible ? ERROR LINE
}
ResourceMap类没有设置值方法。*.resw文件可能只包含字符串和文件路径。在运行时,Windows.ApplicationModel.Resources.ResourceLoader类和Windows.ApplicationModel.Resources.Core命名空间中的类型提供对应用程序资源的访问,但不提供写API。ResourceMap类没有SetValue方法。*.resw文件可能只包含字符串和文件路径。在运行时,Windows.ApplicationModel.Resources.ResourceLoader类和Windows.ApplicationModel.Resources.Core命名空间中的类型提供对应用程序资源的访问,但不提供写API。要存储读/写应用程序值,应使用。您可以使用本地和/或漫游设置
资源是只读的,用于在运行时加载的UI字符串、图像等,可能需要根据用户语言、辅助功能设置、显示比例因子等进行更改。要存储读/写应用程序值,应使用。您可以使用本地和/或漫游设置
资源是只读的,用于运行时加载的UI字符串、图像等,可能需要根据用户语言、辅助功能设置、显示比例因子等进行更改。设置?您使用ResourceLoader,它在中有很好的描述。没有可用的设置值吗?资源文件是只读的吗?这两行的区别是什么?:ResourceContext ResourceContext=ResourceContext.GetForViewIndependentUse();和ResourceContext ResourceContext=新的ResourceContext();设置?您使用ResourceLoader,它在中有很好的描述。没有可用的设置值吗?资源文件是只读的吗?这两行的区别是什么?:ResourceContext ResourceContext=ResourceContext.GetForViewIndependentUse();和ResourceContext ResourceContext=新的ResourceContext();