如何读/写自定义资源文件(resw)上的键/值(存储字符串和条件资源)?如何完全控制(读/写)自定义资源resw文件(通用Windows)
我添加了资源文件(resw)来存储应用程序的设置。接着 ?
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
}
设置?您使用ResourceLoader,它在[MSDN文章](https://msdn.microsoft.com/en-us/library/hh694557.aspx)中有详细描述。 –
没有setvalue avaible?只读文件资源? –
这几行有何区别?: ResourceContext resourceContext = ResourceContext.GetForViewIndependentUse(); 和 ResourceContext resourceContext = new ResourceContext(); –