private void QuestListItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { QuestListItemViewModel quest = (QuestListItemViewModel)sender; if (e.PropertyName != PropertyInspector.GetPropertyName(() => quest.IsVisible)) { return; } NotifyOfPropertyChange(() => QuestCompletion); NotifyOfPropertyChange(() => IsVisible); }
private void InitializeViewModel(QuestType questType) { Quests = new List <QuestListItemViewModel>(); Header = questType.Type; foreach (var item in questType.Quests) { var questListItem = new QuestListItemViewModel(item); questListItem.PropertyChanged += QuestListItem_PropertyChanged; Quests.Add(questListItem); } TotalQuests = questType.Quests.Count; CompletedQuests = questType.Quests.Where(x => x.Completed).Count(); IsExpanded = false; }