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

            treeView.ItemsSource = _theThing.Children;
        }
예제 #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;
        }
예제 #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();
 }
예제 #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;
        }
예제 #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();
 }
예제 #6
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());
        }
예제 #7
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());
        }
예제 #8
0
        private void resetData()
        {
            do
            {
                _theThing = new TreeViewDataItem(DataTree.GetRandomDataTree(5, 5), "Children");
            }
            while (_theThing.Children.Count < 3);

            treeView.ItemsSource = _theThing.Children;
        }