如何本地化列表视图项目文本?

发布于 2024-12-27 13:20:05 字数 128 浏览 3 评论 0原文

我在设计时将项目添加到列表视图中,

但项目的文本没有添加到相应的 .resx 文件中。

我需要在 Listview 中设置任何属性吗?

我已将底层表单的 Localize 属性设置为“true”

I am adding Items into the listview at design time,

but item's Text is not getting added to corresponding .resx file.

Do i need to set any property in Listview?

I have set Localize property of the underlaying Form to 'true'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千紇 2025-01-03 13:20:05
    private void PopulateListView()
    {
        ListView1.Width = 300;
        ListView1.Location = new System.Drawing.Point(10, 50);

        // Declare and construct the ColumnHeader objects.
        ColumnHeader header1, header2;
        header1 = new ColumnHeader();
        header2 = new ColumnHeader();

        // Set the text, alignment and width for each column header.
        header1.Text = "Column1"; //Helper.getlocalStringResource("Xinga.LocalStrings.ColumnHeader.ResourceValue");
        header1.Width = 100;

        header2.Text = "Column2"; //Helper.getlocalStringResource("Xinga.LocalStrings.ColumnHeader.ResourceValue");
        header2.Width = 100;

        // Add the headers to the ListView control.
        ListView1.Columns.Add(header1);
        ListView1.Columns.Add(header2);

        ListView1.View = View.Details;  //important to see the headers
    }

然后可以本地化 header.Text...

    private void PopulateListView()
    {
        ListView1.Width = 300;
        ListView1.Location = new System.Drawing.Point(10, 50);

        // Declare and construct the ColumnHeader objects.
        ColumnHeader header1, header2;
        header1 = new ColumnHeader();
        header2 = new ColumnHeader();

        // Set the text, alignment and width for each column header.
        header1.Text = "Column1"; //Helper.getlocalStringResource("Xinga.LocalStrings.ColumnHeader.ResourceValue");
        header1.Width = 100;

        header2.Text = "Column2"; //Helper.getlocalStringResource("Xinga.LocalStrings.ColumnHeader.ResourceValue");
        header2.Width = 100;

        // Add the headers to the ListView control.
        ListView1.Columns.Add(header1);
        ListView1.Columns.Add(header2);

        ListView1.View = View.Details;  //important to see the headers
    }

The header.Text can then be localized...

几度春秋 2025-01-03 13:20:05

在表单属性窗口中切换语言。然后更改 ListViewItem 的 Text 属性。

检查 resx 中的“其他”部分或在 Xml 编辑器中打开它。

Switch the Language in form Properties window. Then change the Text property of your ListViewItem.

Check Other section in your resx or open it in Xml Editor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文