Build ListViewItem.Content

  • Thread starter Thread starter Eternal Snow
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top