public AllGoalsViewModel(GoalData goalData, ProjectData projectData, TaskData taskData) { if (goalData == null) { throw new ArgumentNullException("goalData"); } if (projectData == null) { throw new ArgumentNullException("projectData"); } if (taskData == null) { throw new ArgumentNullException("taskData"); } base.DisplayName = Properties.Resources.Goals_DisplayName; base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/goal.png"; _goalData = goalData; _projectData = projectData; _taskData = taskData; // Subscribe for notifications of when a new goal is saved. _goalData.GoalAdded += this.OnGoalAdded; _goalData.GoalUpdated += this.OnGoalUpdated; _goalData.GoalDeleted += this.OnGoalDeleted; // Populate the AllGoals collection with GoalViewModels. this.AllGoals = new ObservableCollection <GoalViewModel>(); this.AllGoals.CollectionChanged += this.OnCollectionChanged; this.PageFirst(); SortColumns.Add(new SortableProperty() { Description = "Title", Name = "Title" }); SortColumns.Add(new SortableProperty() { Description = "Status", Name = "StatusId" }); SortColumns.Add(new SortableProperty() { Description = "Category", Name = "CategoryId" }); SortColumns.Add(new SortableProperty() { Description = "Date Created", Name = "CreatedDate" }); SortColumns.Add(new SortableProperty() { Description = "Date Completed", Name = "CompletedDate" }); SelectedSortColumn = SortColumns.FirstOrDefault(); // select the first goal GoalViewModel firstGoal = AllGoals.FirstOrDefault(); if (firstGoal != null) { firstGoal.IsSelected = true; } }