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>
You want to add an item to the list, right?
Try:
ListViewItem lvi = new ListViewItem();
MyListView.Items.Add(lvi);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.