Forum Discussion

smitad's avatar
smitad
Occasional Contributor
14 years ago

Unable to uniquely identify objects on a WPFGrid

Hi,



We are working with a WPFGrid object which has Infragistic objects nested in it witht he following hierarchy, Sys.Process("Passport").WinFormsObject("WorkspaceWindowHost").WinFormsObject("_workspacePanel").WinFormsObject("ElementHost", "").WPFObject("HwndSource: AdornerDecorator", "").WPFObject("AdornerDecorator", "", 1).WPFObject("AvalonAdapter", "", 1).WPFObject("Workspace", "", 1).WPFObject("_containerGrid").WPFObject("Grid", "", 1).WPFObject("DockPanel", "", 2).WPFObject("_dockingSite").WPFObject("DockPanel", "", 1).WPFObject("x29374abfc5f6533a", "", 1).WPFObject("_documentContainer").WPFObject("SplitContainer", "", 1).WPFObject("WindowGroup", "", 1).WPFObject("DockableWindow", "", 1).WPFObject("_blotter").WPFObject("_rootGrid").WPFObject("_mainGrid").WPFObject("_mainGridsChildGrid").WPFObject("_grid").WPFObject("Grid", "", 1).WPFObject("RecordListControl", "", 1).WPFObject("DataRecordPresenter", "", 4).WPFObject("DataRecordCellArea", "", 1).WPFObject("ContentItemGrid").WPFObject("CellValuePresenter", "4689.T", 2).WPFObject("XamMaskedEditor", "", 1)



We are unable to Identify the XamMaskedEditor object uniquely. We also have filter combo boxes as headers and this appears as a DataRecordPresenter with the upperbound index and has the following hierarchy.

Sys.Process("Passport").WinFormsObject("WorkspaceWindowHost").WinFormsObject("_workspacePanel").WinFormsObject("ElementHost", "").WPFObject("HwndSource: AdornerDecorator", "").WPFObject("AdornerDecorator", "", 1).WPFObject("AvalonAdapter", "", 1).WPFObject("Workspace", "", 1).WPFObject("_containerGrid").WPFObject("Grid", "", 1).WPFObject("DockPanel", "", 2).WPFObject("_dockingSite").WPFObject("DockPanel", "", 1).WPFObject("x29374abfc5f6533a", "", 1).WPFObject("_documentContainer").WPFObject("SplitContainer", "", 1).WPFObject("WindowGroup", "", 1).WPFObject("DockableWindow", "", 1).WPFObject("_blotter").WPFObject("_rootGrid").WPFObject("_mainGrid").WPFObject("_mainGridsChildGrid").WPFObject("_grid").WPFObject("Grid", "", 1).WPFObject("RecordListControl", "", 1).WPFObject("DataRecordPresenter", "", 10).WPFObject("HeaderPresenter", "", 1).WPFObject("HeaderLabelArea", "", 1).WPFObject("VirtualizingDataRecordCellPanel", "", 1).WPFObject("LabelPresenter", "Side", 1).WPFObject("_filterCombo").WPFObject("AdornerLayer", "", 1)



We have to match the CellValuePresenter WPFControlOrdinalNo with the LabelPresenter "side" WPFControlOrdinalNo  to know that the value in CellValuePresenter is the value for "Side" Label at a given row. Since we do not have a cell header we have to work on ordinals and these are not fixed. We need to know what approach we can take to fix this problem. As I have seen if the filter on the grid changes the indexes change too.

Please advise.

1 Reply

  • Smita,


    As I can see, you are trying to work with grid rows by using the objects you see in the Object Browser's object tree. It is not recommended to work with the rows in this way. The tree displays objects that TestComplete recognizes in the tested application. Typically, these objects correspond only to visible rows and they change if you scroll the grid contents.


    I suggest that you explore your application in the Object Browser and find the test object that corresponds to your grid control. In your case, this could be WPFObject("_rootGrid"), WPFObject("_mainGrid"), WPFObject("_mainGridsChildGrid"), WPFObject("_grid") or some other object in the hierarchy. This object should have the Extended category of properties and this category should contain the wValue, wRowCount, wColumn, wColumnCount and other grid-specific properties. 


    Once you find the object, you can use native methods and properties to perform the actions you need, or you can try using methods and properties, which TestComplete provides for grid controls.