private void btnRemoveHistoricalItem_Click(object sender, RoutedEventArgs e) { if (SelectedHistoricalData != null && SelectedHistoricalData.Count > 0) { for (int i = SelectedHistoricalData.Count - 1; i >= 0; i--) { for (int j = HistoricalData.Count - 1; j >= 0; j--) { if (HistoricalData[j] == SelectedHistoricalData[i]) { HistoricalData.RemoveAt(j); break; } } } SelectedHistoricalData = null; } }