Gaddigesh
Gaddigesh

Reputation: 1953

How to localize listview items text?

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'

Upvotes: 0

Views: 860

Answers (2)

Petr Behenský
Petr Behenský

Reputation: 620

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.

Upvotes: 0

andre
andre

Reputation: 140

    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...

Upvotes: 1

Related Questions