private void DeleteTarget(object sender, RoutedEventArgs e) { GroupElement groupElement = Targets.SelectedItem as GroupElement; if (groupElement != null) { TargetElement selElm = groupElement.ElementBase as TargetElement; if (selElm != null) { if (!selElm.IsImported) { DeleteQuestionDialog dialog = new DeleteQuestionDialog(); bool?dialogResult = dialog.ShowDialog(); if (!dialogResult.HasValue) { return; } if (dialogResult.Value) { m_Project.DeleteTarget(groupElement); } } } else { DeleteTargetBtn.IsEnabled = false; } } }