//public event Action RemoveItem; private void Delete_Button_Click(object sender, RoutedEventArgs e) { var btn = (Button)sender; KeyValuePair <object, object> dvp; if (btn.DataContext is KeyValuePair <object, object> ) { dvp = (KeyValuePair <object, object>)btn.DataContext; } else { dvp = new KeyValuePair <object, object>(); } Data.Remove(dvp.Key); //if (RemoveItem != null) //{ // RemoveItem(); //} var ef = new ExtensionInfoField(Data); PropGrid.DataContext = ef; PropGrid.SelectedObject = ef; MainView.ItemsSource = null; MainView.ItemsSource = Data; }
//public event Action RemoveItem; private void Delete_Button_Click(object sender, RoutedEventArgs e) { var btn = (Button)sender; KeyValuePair<object, object> dvp; if (btn.DataContext is KeyValuePair<object, object>) { dvp = (KeyValuePair<object, object>)btn.DataContext; } else { dvp = new KeyValuePair<object, object>(); } Data.Remove(dvp.Key); //if (RemoveItem != null) //{ // RemoveItem(); //} var ef = new ExtensionInfoField(Data); PropGrid.DataContext = ef; PropGrid.SelectedObject = ef; MainView.ItemsSource = null; MainView.ItemsSource = Data; }