/// <summary> /// to count the number of publication every year /// </summary> public void LoadCumCount() { CumulativePublicationsWindow cw = new CumulativePublicationsWindow(); Dictionary <int, int> cumCount = new Dictionary <int, int>(); int current_year = DateTime.Now.Year; int start_year = details.EarliestStart().Year; for (int i = start_year; i <= current_year; i++) { var filtered = from filter in details.PublicationList where filter.Year <= i select filter; cumCount.Add(i, filtered.Count()); } cw.DataContext = cumCount; //data binding cw.ShowDialog(); //to show dialog }