Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将observablecollection成员连接到应用程序资源(resx)文件_C#_Silverlight_Windows Phone 7_Windows Phone 8 - Fatal编程技术网

C# 如何将observablecollection成员连接到应用程序资源(resx)文件

C# 如何将observablecollection成员连接到应用程序资源(resx)文件,c#,silverlight,windows-phone-7,windows-phone-8,C#,Silverlight,Windows Phone 7,Windows Phone 8,嘿,伙计们,首先我为这个糟糕的解释感到抱歉。我的任务是翻译一个我不久前写的应用程序,通常没有什么特别的 但现在我正处在一个关键时刻。我的应用程序的一个功能是保存历史记录。我为此创建了一个基本类 public class GHistoryClass { public GHistoryClass(string act, string icop, string categ, string desc,) { this.m_Action =

嘿,伙计们,首先我为这个糟糕的解释感到抱歉。我的任务是翻译一个我不久前写的应用程序,通常没有什么特别的

但现在我正处在一个关键时刻。我的应用程序的一个功能是保存历史记录。我为此创建了一个基本类

 public class GHistoryClass
    {
       public GHistoryClass(string act, string icop, string categ, string desc,)
        {
            this.m_Action = act;
            this.m_IconPath = icop;
            this.m_Description = desc;
            this.m_Category = categ;

        }
        public string m_Action { get; set; }
        public string m_Description { get; set; }
        public string m_Category { get; set; }
        public string m_IconPath { get; set; }
    }
我正在将历史记录像
observeablecollection
一样保存在
IsolatedStorage
中。 当语言改变时,我想翻译历史

例如,我不知道如何将
m_Action
连接到
本地化资源

任何想法都将不胜感激

编辑

我认为应该做的是将
AppResources
属性名保存为字符串 因此
m_Action=“AppResources.firstaction”
然后我的想法是将其转换为
PropertyPath
。 这是一个好主意吗?如何将
字符串
转换为
对象
名称?

将资源(resx)文件添加到项目中时,每个资源都会生成一个属性

internal class MyResources
{
    // other properties etc

    internal static string SomeLabel 
    {
        get
        {
            return ResourceManager.GetString("SomeLabel", resourceCulture);
        }
    }
}
通常,您会像这样使用此资源:

string label = MyResources.SomeLabel;
但你不必这么做。相反,您可以直接访问ResourceManager:

string label = MyResources.ResourceManager.GetString(m_Action);

我花了将近两天的时间寻找,如果你在我身边,我会吻你