private IEnumerable <OutlineItemViewModel> Flatten(OutlineItemViewModel item) { foreach (var child in item.Children) { yield return(child); foreach (var flatChild in Flatten(child)) { yield return(flatChild); } } }
private bool ExistsExpanded(OutlineItemViewModel item, OutlineItemViewModel[] ownItems) { return(ownItems.FirstOrDefault(e => e.Data.Text == item.Data.Text || e.Data.TextPosition == item.Data.TextPosition)?.IsExpanded ?? false); }