private void SetupListData() { LearnerItemsCV = null; if (App.ILRMessage.LearnerList.Count > 0) { LearnerItemsCV = CollectionViewSource.GetDefaultView(App.ILRMessage.LearnerList); LearnerItemsCV.Refresh(); OnPropertyChanged("LearnerItemsCV"); LearnerItemsCV.Filter = LearnerFilter; LearnerDetailGrid.Visibility = System.Windows.Visibility.Visible; LearnerItemsCV.MoveCurrentTo(LearnerItemsCV.CurrentItem as Learner); SetSubControl(LearnerItemsCV.CurrentItem as Learner); LearnerItemsCV.Refresh(); OnPropertyChanged("LearnerItemsCV"); } else { if (LearnerItemsCV != null) { LearnerItemsCV.Refresh(); OnPropertyChanged("LearnerItemsCV"); } OnPropertyChanged("LearnerItemsCV"); LearnerDetailGrid.Visibility = System.Windows.Visibility.Hidden; LearnerItemsCV = null; } }
private void DataItemListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (App.ILRMessage.LearnerList.Count > 0) { if (e.AddedItems.Count > 0) { Learner lr = e.AddedItems[0] as Learner; LearnerItemsCV.MoveCurrentTo(lr); lr.IsSelected = true; SetSubControl(lr); } LearnerDetailGrid.Visibility = System.Windows.Visibility.Visible; } }
private void AddLearner_Click(object sender, RoutedEventArgs e) { Learner NewLr = App.ILRMessage.CreateLearner(); App.ILRMessage.Save(); if (App.ILRMessage.LearnerList.Count == 1) { SetupListData(); } NewLr.IsSelected = true; LearnerItemsCV.MoveCurrentTo(NewLr); LearnerItemsCV.Refresh(); OnPropertyChanged("LearnerItemsCV"); }