private void Edit_Item_Click(object sender, RoutedEventArgs e) { if (ListView.SelectedIndex >= 0) { var editItem = new EditItem(ListView.SelectedIndex); editItem.ShowDialog(); } }