Remove the Selected Item From ListView

前端 未结 7 1657
野的像风
野的像风 2021-01-18 06:29

How can I remove a selected item from a listview?

7条回答
  •  粉色の甜心
    2021-01-18 07:12

    Yet another way to remove item(s) from a ListView control (that has GridView) (in WPF)--

    var selected = myList.SelectedItems.Cast().ToArray();
    foreach(var item in selected)
    {
        myList.Items.Remove(item);
    }
    
    
    

    where myList is the name of your ListView control

    提交回复
    热议问题