如何讀/寫自定義資源文件(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(); –