private void cboxTypesString_SelectionChanged(object sender, RoutedEventArgs e) { DataType selectedType; InputTypeViewModel inputTypeViewModel = ((ComboBox)sender).DataContext as InputTypeViewModel; if (inputTypeViewModel == null) { return; } int typeIndex = ((ComboBox)sender).SelectedIndex - 1; if (typeIndex >= 0) { selectedType = AllDataTypes[typeIndex]; } else { selectedType = null; } inputTypeViewModel.SelectedDataType = selectedType; }
private void btnDeleteInputType_Click(object sender, RoutedEventArgs e) { InputTypeViewModel inputToDelete = (InputTypeViewModel)((Button)sender).DataContext; InputTypesViewModels.Remove(inputToDelete); }