private void OnTravelExpenseItemsSelectionChanged(object obj) { Telerik.Windows.Controls.SelectionChangeEventArgs e = obj as Telerik.Windows.Controls.SelectionChangeEventArgs; if (e == null) { return; } foreach (TravelExpense item in e.RemovedItems) { SelectedTravelExpenses.Remove(item); } foreach (TravelExpense item in e.AddedItems) { SelectedTravelExpenses.Add(item); } }
public override void OnNavigatedTo(NavigationContext navigationContext) { base.OnNavigatedTo(navigationContext); SelectedTravelExpenses.Clear(); // Read TravelExpenses travelExpenses = new ObservableCollection <TravelExpense>(dbAccess.GetAllTravelExpenses()); ListOfTravelExpenses = CollectionViewSource.GetDefaultView(travelExpenses); ListOfTravelExpenses.CurrentChanged -= ListOfTravelExpenses_CurrentChanged; ListOfTravelExpenses.CurrentChanged += ListOfTravelExpenses_CurrentChanged; RaisePropertyChanged("ListOfTravelExpenses"); if (travelExpenses.Count > 0) { selectedItem = travelExpenses[0]; } }