Esempio n. 1
0
 public void CollapseNode(int index)
 {
     LogText = "Index: " + index;
     try
     {
         RegisterEvent(ExpandCollapsePattern.ExpandCollapseStateProperty);
         SelectNode(index);
         AutomationElement retVal = GetSelectedNode();
         ExpandCollapseHelper.Collapse(retVal);
     }
     catch (ProdOperationException err)
     {
         throw;
     }
 }
Esempio n. 2
0
        /// <summary>
        ///     Enumerates all nodes ion the TreeView and adds to a collection
        /// </summary>
        /// <param name = "aeRoot">The root tree node.</param>
        private void EnumControlElements(AutomationElement aeRoot)
        {
            while (aeRoot != null)
            {
                AllNodes.Add(aeRoot);
                _chk++;
                int ret = ExpandCollapseHelper.Expand(aeRoot);
                if (ret == -1)
                {
                    ExpandCollapseHelper.Collapse(AllNodes[_treeIndex]);
                    aeRoot     = TreeWalker.ControlViewWalker.GetNextSibling(AllNodes[_treeIndex]);
                    _treeIndex = _chk;
                }
                else
                {
                    aeRoot = TreeWalker.ControlViewWalker.GetFirstChild(aeRoot);
                }
                EnumControlElements(aeRoot);
                aeRoot = null;
            }

            return;
        }
 private static void UiaCollapse(BaseProdControl control)
 {
     ExpandCollapseHelper.Collapse(control.UIAElement);
 }