Build ListViewItem.Content

E

Eternal Snow

Hi all.

I'm using ListView in WPF file.

I added 3 column in a view (ListView.View = AGridView, with 3 column in the
view).

ListViewItem item = new ListViewItem();
item.Content = new String[] { "1", "2", "3" };
listView.Items.Add(item);

The result display is:
String[] Array String[] Array String[] Array

So, how can I do that in order to get:
1 2 3

Thanks.
 
E

Eternal Snow

ListView is defined in XAML:
<ListView Name="listView" />

Columns are added by code (not in XAML):
GridView view = new GridView();
GridViewColumn c1 = new GridViewColumn();
c1.Header = "ID";
view.Columns.Add(c1);
GridViewColumn c2 = new GridViewColumn();
c2.Header = "Name";
view.Columns.Add(c2);
GridViewColumn c3 = new GridViewColumn();
c3.Header = "Description";
view.Columns.Add(c3);
listView.View = view;

Create Item:
ListViewItem item = new ListViewItem();
item.Content = new string[] { "1", "2", "3" };
listView.Items.Add(item);

only an empty line with no data can be found in that listview.
 
E

Eternal Snow

Sorry, mistake.

The last words of 1st reply should be:

Only an item like
String[] Array String[] Array String[] Array
can be found in that listview.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top