Exemplo n.º 1
0
        //-----------------------------------------------------------------------
        public void SetRootItem(DataItem item)
        {
            RootItems.Clear();
            RootItems.Add(item);
            m_storedRootItems.Add(item);
            GraphNodeItems.Clear();

            foreach (var i in Descendants)
            {
                i.DataModel = this;

                if (item is GraphNodeItem && !GraphNodeItems.Contains(item))
                {
                    if (!GraphNodeItems.Contains(item as GraphNodeItem))
                    {
                        GraphNodeItems.Add(item as GraphNodeItem);
                    }
                }
            }

            if (RootItems.Any(e => !(e is GraphNodeItem)))
            {
                ShowAsGraph     = false;
                ShowAsDataModel = true;
            }
            else
            {
                ShowAsGraph     = true;
                ShowAsDataModel = false;
            }

            RaisePropertyChangedEvent("ShowAsGraph");
            RaisePropertyChangedEvent("ShowAsDataModel");
        }