Exemplo n.º 1
0
        private bool ExpandAndSelect(IEnumerable <TaskItemViewModel> tasks, int id)
        {
            foreach (var t in tasks)
            {
                if (t.Data.TaskItemID == id)
                {
                    TaskItemViewModel parent = t.Parent;

                    while (parent != null)
                    {
                        parent.IsExpanded = true;
                        parent            = parent.Parent;
                    }

                    t.Selected = true;
                    return(true);
                }
                else if (t.Children != null)
                {
                    bool expanded = ExpandAndSelect(t.Children, id);
                    if (expanded)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        private void CreateChildrenViewModels()
        {
            if (data.Children != null)
            {
                children = new List <TaskItemViewModel>();

                var ordered = data.Children;

                foreach (var c in ordered)
                {
                    var vm = new TaskItemViewModel(c);
                    vm.Parent = this;

                    children.Add(vm);
                }
            }
        }