private void resetData()
        {
            do
            {
                _theThing = new TreeViewDataItem(DataTree.GetRandomDataTree(5, 5), "Children");
            }while (_theThing.Children.Count < 3);

            treeView.ItemsSource = _theThing.Children;
        }
Example #2
0
        internal TreeViewDataItem(object dataItem, string childrenPropertyName, TreeViewDataItem parent)
        {
            if (dataItem == null)
            {
                throw new ArgumentNullException("dataItem");
            }
            if (childrenPropertyName == null)
            {
                throw new ArgumentNullException("childrenPropertyName");
            }

            _dataItem = dataItem;
            _childrenPropertyName = childrenPropertyName;
            _parent = parent;
        }
Example #3
0
 private static object[] getRandomObjectPath(TreeViewDataItem thing)
 {
     List<TreeViewDataItem> path = new List<TreeViewDataItem>();
       Random rnd = Util.Rnd;
       while (thing != null) {
     if (thing.Children.Count > 0) {
       thing = thing.Children[rnd.Next(thing.Children.Count)];
       path.Add(thing);
     }
     else {
       thing = null;
     }
       }
       return path.ToArray();
 }
Example #4
0
        internal TreeViewDataItem(object dataItem, string childrenPropertyName, TreeViewDataItem parent)
        {
            if (dataItem == null)
            {
                throw new ArgumentNullException("dataItem");
            }
            if (childrenPropertyName == null)
            {
                throw new ArgumentNullException("childrenPropertyName");
            }

            _dataItem             = dataItem;
            _childrenPropertyName = childrenPropertyName;
            _parent = parent;
        }
Example #5
0
 private static int[] getRandomIntPath(TreeViewDataItem thing)
 {
     List<int> path = new List<int>();
       Random rnd = Util.Rnd;
       while (thing != null) {
     if (thing.Children.Count > 0) {
       int index = rnd.Next(thing.Children.Count);
       thing = thing.Children[index];
       path.Add(index);
     }
     else {
       thing = null;
     }
       }
       return path.ToArray();
 }
        private static object[] getRandomObjectPath(TreeViewDataItem thing)
        {
            List <TreeViewDataItem> path = new List <TreeViewDataItem>();
            Random rnd = Util.Rnd;

            while (thing != null)
            {
                if (thing.Children.Count > 0)
                {
                    thing = thing.Children[rnd.Next(thing.Children.Count)];
                    path.Add(thing);
                }
                else
                {
                    thing = null;
                }
            }
            return(path.ToArray());
        }
        private static int[] getRandomIntPath(TreeViewDataItem thing)
        {
            List <int> path = new List <int>();
            Random     rnd  = Util.Rnd;

            while (thing != null)
            {
                if (thing.Children.Count > 0)
                {
                    int index = rnd.Next(thing.Children.Count);
                    thing = thing.Children[index];
                    path.Add(index);
                }
                else
                {
                    thing = null;
                }
            }
            return(path.ToArray());
        }
Example #8
0
        private void resetData()
        {
            do
            {
                _theThing = new TreeViewDataItem(DataTree.GetRandomDataTree(5, 5), "Children");
            }
            while (_theThing.Children.Count < 3);

            treeView.ItemsSource = _theThing.Children;
        }