How to retrieve child obejcts
Hi,
I'm trying to retrieve a child objects and check their existence under their parent object. how do i do it? anything i tried failed
I know it is possible to achieve it using FindAllChildren but find it hard to implement in this case as sometimes i'm picking a property to search for and a value and get an error .
The child objects are created dynamically and i should make sure the right name does appear under the right parent.
Attached is a screen shot of the objects tree.
The children i'm aiming for are the printer, printer 2 .......
The peace of code so far
for(k = 1 ; k <= Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.TreeViewItem.ChildCount - 2 ; k++)
{
var ExistingPrintersList = Aliases.QuickDesign_ConfigurationManager.BreadsScrumpTree.FunctionalItemsControl.Tree.FindAllChildren("ClrClassName", "TreeViewItem", 4).toArray()
// Verify Printer item exists under each device
//if(Aliases.QuickDesign_ConfigurationManager.BreadsScrumpTree.FunctionalItemsControl.Tree.WPFObject("TreeViewItem", "", j).Exists)
Pass(Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.TreeViewItem.EditableTextBlock.WPFObject("Grid", "", 1).WPFObject("TextBlock", "Printer " + k, 1).Text + " was added properly under " + Device)
Fail(Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.TreeViewItem.EditableTextBlock.WPFObject("Grid", "", 1).WPFObject("TextBlock", "Printer " + k, 1).Text + " wasn't added properly under " + Device)
}
Let me know if you need any more information to sort this one out.
Thx,
OV