WPF Delete Selected Item From Listview

we often need to delete item from Listview. You have to use context menu for perform delete operation. then on your delete event just write:



 private void ticketRemovebutton_Click(object sender, RoutedEventArgs e)  
 {  
    if (ticketlistView.SelectedItem != null)  
      {  
       ticketlistView.Items.RemoveAt(ticketlistView.Items.IndexOf(ticketlistView.SelectedItem));  
      }  
    else  
      {  
       MessageBox.Show("Please select item for remove from the list");  
      }  
 }  









Download the Latest Sample

Enjoy....!!

Popular posts from this blog

WPF Crystal Report Viewer Using SAP

ASP.NET MVC razor SAP Crystal report