Reputation: 16685
I would have thought that I should be able to do something like this:
ListViewItem lvi = MyListView.Items.Add();
But MyListView.Items.Add()
returns an integer. This seems to differ from the way it’s done in WinForms, can anyone point me in the right direction as to how this is achieved?
WPF Listview:
<ListView Margin="12,108,12,12" Name="MyListView">
<ListView.View>
<GridView>
<GridViewColumn Header="Column1" Width="300" />
<GridViewColumn Header="Column2" Width="100" />
</GridView>
</ListView.View>
</ListView>
Upvotes: 0
Views: 2087
Reputation: 4375
You want to add an item to the list, right?
Try:
ListViewItem lvi = new ListViewItem();
MyListView.Items.Add(lvi);
Upvotes: 1