由于Empty Name属性,无法本地化ObjectListView OLVColumn

时间:2012-02-23 08:50:59

标签: c# localization objectlistview

所以,我正在尝试本地化/翻译现有的应用程序,这个代码在基础表单上运行,一切都按预期工作,直到它运行到BrightIdeasSoftware.ObjectListView(它正在迭代子项等) )问题是在ObjectListView上应该设置名称,但它总是为空。

ComponentResourceManager parentManager = new ComponentResourceManager(this.GetType());
CultureInfo language = new CultureInfo("en");
foreach (Control subControl in this.Controls) {
    parentManager.ApplyResources(subControl, subControl.Name, language);
}

当它遇到ObjectListView时:

ObjectListView localControl = (ObjectListView)subControl;
foreach (OLVColumn column in localControl.Columns)
{
    parentManager.ApplyResources(column, column.Name/*This is the issue*/, language);
}

当我在设计器代码中设置列的名称时,它确实按预期工作,并且在更改之后它确实再次正确地生成了Name代码,但我无法通过整个项目来添加name属性每次将一个objectListViews添加到项目中时都是。

我已经尝试侦察任何包含Name值的属性,但未能找到任何属性(它在设计器GUI中显示)。

我已经尝试在OLV支持论坛上寻找解决方案,但找不到一个,并注意到很多人在OLV遇到问题时得到了一些帮助,所以我想我先在这里寻求帮助。 / p>

非常感谢任何帮助,提前谢谢!

1 个答案:

答案 0 :(得分:0)

它没有自动添加“名称”

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.firebase:firebase-messaging:x.x.x'
}
apply plugin: 'com.google.gms.google-services'

给它一个“名字”

this.olvColSetPartName.AspectName = "Name";
resources.ApplyResources(this.olvColSetPartName, "olvColSetPartName");