Forum Discussion

BillSimpson's avatar
BillSimpson
Occasional Contributor
10 years ago

Using Infragistics WPF xamDataGrid, how do you add a child row to a parent row

Attached is a sample recorded and playback script of adding a row to an Infragistics xamDataGrid, then adding a child row. With the expected results of a parent row related to the child row.

 

The result of playback is Unable to find the object WPFObject("CellValuePresenter", "", 1).

 

The recording appears to be referencing the XamTextEditor cell of the parent row, and not the child row cell.

The object spy browser appears to also reference the same object.

Either  the CellValuePresenter or the XamTextEditor object is incorrect.

 

Regards

Bill Simpson

 

  • Hi


    After some trial and error if I added in the following lines using WaitWPFObject that waits for

    various objects in the calling tree. e.g.


    call Aliases.RHICOMS_SAM.HwndSource_ShellWindow.ShellWindow.LayoutRoot.Grid.XamDockManager.DocumentContentHost.TabbedDocumentSplitPane.SplitPane.ztabGroupMainRegion.ContentpaneComponentsClasses.ModuleComponentsDimensionsView.Grid.XamDockManager.SplitPane.ComponentClassesContentPane.ComponentClassesGrid.Grid.RecordListControl.DataRecordPresenter4.DockPanel.DataRecordCellArea.ContentItemGrid.WaitWPFObject("CellValuePresenter")

    call Aliases.RHICOMS_SAM.HwndSource_ShellWindow.ShellWindow.LayoutRoot.Grid.XamDockManager.DocumentContentHost.TabbedDocumentSplitPane.SplitPane.ztabGroupMainRegion.ContentpaneComponentsClasses.ModuleComponentsDimensionsView.Grid.XamDockManager.SplitPane.ComponentClassesContentPane.ComponentClassesGrid.Grid.RecordListControl.DataRecordPresenter4.DockPanel.DataRecordCellArea.ContentItemGrid.CellValuePresenter.WaitWPFObject("XamTextEditor")


    before setting xamTextEditor2

    then it works.

     

    Thank you for the guidance.

     

    Regards

    Bill Simpson


     

  • BillSimpson's avatar
    BillSimpson
    Occasional Contributor

    Hi

     

    As additional info, below is the recorded vbScript code as I cannot see the attached file that went with the original post

     

    Sub TestAddingChildRow
      Dim grid
      Dim grid2
      Dim xamDataGridEx
      Dim recordListControl
      Dim xamTextEditor
      Dim button
      ' display the xamDataGrid
      Set grid = Aliases.RHICOMS_SAM.HwndSource_ShellWindow.ShellWindow.LayoutRoot
      Call grid.Grid2.ApplicationRibbon.ClickItem("Configuration|Component Classes")
      Call Delay(1901)
      Set grid2 = grid.Grid.XamDockManager.DocumentContentHost.TabbedDocumentSplitPane.SplitPane.ztabGroupMainRegion.ContentpaneComponentsClasses.ModuleComponentsDimensionsView.Grid
      Set xamDataGridEx = grid2.XamDockManager.SplitPane.ComponentClassesContentPane.ComponentClassesGrid
      Set recordListControl = xamDataGridEx.Grid.RecordListControl
      Call recordListControl.Drag(1128, 24, -5, 205)
      Call Delay(1433)
      ' go to last row on the grid and add the new parent row
      Call xamDataGridEx.ClickNewRowCell("Component Class")
      Call Delay(1146)
      Set xamTextEditor = recordListControl.DataRecordPresenter.DockPanel.DataRecordCellArea.ContentItemGrid.CellValuePresenter.XamTextEditor
      ' type in value to the parent row which becomes row 216
      Call xamTextEditor.Keys("zzzzzz my new row")
      Call Delay(1647)
      ' save the grid changes
      Set button = grid2.Header.btnSave
      button.ClickButton
      Call Delay(1188)
      Call xamDataGridEx.ClickCellR(216, "Component Class")
      Call Delay(933)
      ' right click popup menus adds a child row
      Call xamDataGridEx.PopupMenu.Click("Add New SubComponent")
      Call Delay(1422)
      xamDataGridEx.Expand(216)
      Call Delay(1423)
      ' now we click in the cell on the new child row
      Call xamDataGridEx.wChildView(216).wChildView(0).ClickCell(0, "Sub Class")
      Call Delay(3423)
      Dim xamTextEditor2
      Call Delay(3423)
      'xamTexteditor2 should be on child row cell, but Object Spy browser values are as follows
      ' with the result that the "my new subrow" updates the incorrect row
      ' or we get an error thatt the object "XamTextEditor" does not exist.
      Set xamTextEditor2 =Aliases.RHICOMS_SAM.HwndSource_ShellWindow.ShellWindow.LayoutRoot.Grid.XamDockManager.DocumentContentHost.TabbedDocumentSplitPane.SplitPane.ztabGroupMainRegion.ContentpaneComponentsClasses.ModuleComponentsDimensionsView.Grid.XamDockManager.SplitPane.ComponentClassesContentPane.ComponentClassesGrid.Grid.RecordListControl.WPFObject("DataRecordPresenter", "", 5).WPFObject("DockPanel", "", 1).WPFObject("DataRecordCellArea", "", 1).WPFObject("ContentItemGrid").WPFObject("CellValuePresenter", "", 1).WPFObject("XamTextEditor", "", 1)
      Call Delay(992)
      Call xamTextEditor2.Keys("my new subrow")
      Call Delay(5150)
      button.ClickButton
    End Sub

    • BillSimpson's avatar
      BillSimpson
      Occasional Contributor

      Hi


      After some trial and error if I added in the following lines using WaitWPFObject that waits for

      various objects in the calling tree. e.g.


      call Aliases.RHICOMS_SAM.HwndSource_ShellWindow.ShellWindow.LayoutRoot.Grid.XamDockManager.DocumentContentHost.TabbedDocumentSplitPane.SplitPane.ztabGroupMainRegion.ContentpaneComponentsClasses.ModuleComponentsDimensionsView.Grid.XamDockManager.SplitPane.ComponentClassesContentPane.ComponentClassesGrid.Grid.RecordListControl.DataRecordPresenter4.DockPanel.DataRecordCellArea.ContentItemGrid.WaitWPFObject("CellValuePresenter")

      call Aliases.RHICOMS_SAM.HwndSource_ShellWindow.ShellWindow.LayoutRoot.Grid.XamDockManager.DocumentContentHost.TabbedDocumentSplitPane.SplitPane.ztabGroupMainRegion.ContentpaneComponentsClasses.ModuleComponentsDimensionsView.Grid.XamDockManager.SplitPane.ComponentClassesContentPane.ComponentClassesGrid.Grid.RecordListControl.DataRecordPresenter4.DockPanel.DataRecordCellArea.ContentItemGrid.CellValuePresenter.WaitWPFObject("XamTextEditor")


      before setting xamTextEditor2

      then it works.

       

      Thank you for the guidance.

       

      Regards

      Bill Simpson