private void UpdateSeasonsSource() { SeasonsListView.ItemsSource = null; //SeasonsListView.ItemsSource = seasons; Binding myBinding = new Binding() { Source = seasons }; SeasonsListView.SetBinding(ListView.ItemsSourceProperty, myBinding); seasonsBindingExpression = SeasonsListView.GetBindingExpression(ListView.ItemsSourceProperty); seasonsBindingExpression.UpdateTarget(); }
//private void FindDuplicates() //{ //} private void FillExistingSeasons() { //using (EntityContextGeneral ctxg = new EntityContextGeneral()) using (FormMergedEntities ctxg = new FormMergedEntities()) { seasons = ctxg.Recruit .AsEnumerable() //.ToList() .Distinct(seasonComparer) //.Select(p => new Season(p)) .Select(p => new SeasonMSSQL(p)) .OrderByDescending(p => p.DateTime) .ToList(); Binding myBinding = new Binding() { Source = seasons }; SeasonsListView.SetBinding(ListView.ItemsSourceProperty, myBinding); seasonsBindingExpression = SeasonsListView.GetBindingExpression(ListView.ItemsSourceProperty); } }