private void DeletePB_Click(object sender, RoutedEventArgs e) { DataRecord record = (DataRecord)filterXamDataGrid.ActiveRecord; if (record == null) { return; } if (record != null) { FilterContainer filter = (FilterContainer)record.DataItem; string MsgStr = "Are you sure that you want to DELETE Filter: " + ((FilterChangerEnum)filter.FilterChanger).ToString() + ":" + ((FilterPositionEnum)filter.PositionNumber).ToString() + " " + filter.Description + "?"; MessageBoxResult result = MessageBox.Show(MsgStr, "Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { WaveguideDB wgDB = new WaveguideDB(); bool success = wgDB.DeleteFilter(filter.FilterID); if (success) { FilterVM.Refresh(); } } } }