/// <summary> /// Constructor for TodoListViewModel that can be backed by any list of Todos, supporting /// filtering and reacting to propertychanged events /// </summary> /// <param name="Recycled">Bool representing whether to load recycled or non-recycled Todos</param> public ToDoListViewModel(bool Recycled = false) { Model = new TodoListModel(); Todos = new ObservableCollection <TodoViewModel>(); NotificationService = new NotificationSender(Todos); ViewableTodos = Todos; _Filter = (x => true); _SelectedIndex = -1; foreach (var todo in Recycled ? Model.GetRecycledTodos() : Model.GetTodos()) { var tdvm = new TodoViewModel(todo); tdvm.PropertyChanged += Todo_PropertyChanged; this.Todos.Add(tdvm); } NotificationService.Start(); }