private void HandleDoubleClick(object sender, MouseButtonEventArgs e) { if (listBox.SelectedItem != null) { modify_contact window = new modify_contact(list[listBox.SelectedIndex], this, listBox.SelectedIndex); window.Owner = MainWindow.GetWindow(this); window.Show(); } }
private void modif_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; if (btn != null) { var st = FindParent <Expander>(btn); //stackpanel as we have added item as stackpanel. if (st != null) { int index = listBox.Items.IndexOf(st); modify_contact win = new modify_contact(list[index], this, index); win.Show(); } } }