Forum Discussion

epatton's avatar
epatton
Occasional Contributor
9 years ago

Infragistics XamGrid - Get Rows

I'm trying to grab the rows from a XamGrid we have in our Silverlight app, but I'm having some issues.

 

In the Object Browser, I see that there is a native Silverlight method called "get_Rows" that supposedly returns a RowCollection, but I'm not sure how to get this value.

 

I'm using a C# project using the AutomatedQA dll references. The "Grid_LineItems()" function returns the grid from the object browser.

 

This returns an AutomatedQA.scripts.var object, but I'm not sure how to get my grid's RowCollection out of it:

 

Grid_LineItems()["get_Rows"]();

 

This returns a Com Object which I can't cast as anything or I get an exception:

 

Grid_LineItems()["get_Rows"]().UnWrap()

 

I tried casting the var object as a RowCollection, but I get a compilation error saying that I can't convert it to that type:

 

var rowColl = (RowCollection)Grid_QuickplanProject()["get_Rows"]();

 

So I guess my question is: How do I get my RowCollection object that the get_Rows method is supposed to return?

3 Replies

  • epatton's avatar
    epatton
    Occasional Contributor

    Is this just not possible? I've tried everything I can think of so far with the same results.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      If it's returning a COM object with fields, etc., that I think is what you're going to have to work with.  This is, effectively, how TestComplete handles objects coming back from Native methods.

       

      So... don't "cast" it as anything... but if you could drop a breakpoint or a watch on that code line and inspect the returned object, please post screenshots of the properties, fields, and methods and we should be able to help you work with it.

      • epatton's avatar
        epatton
        Occasional Contributor

        Thanks for the reply! I'm able to get the value and header from the cells now by grabbing the cells like this

         

                var firstCell = ...path-to-grid...("XamGridName")["Rows"]()["Item"](0)["Cells"]["Item"](0)

         

        I'm stuck trying to figure out how to set the value now, though. SetText() and Keys() throws an exception, and set_Content() doesn't throw anything, but it also doesn't set the value I give to it into the cell. I'm assuming this is because the path I gave above leads to a com_Object and not a SlObject, but I'm not sure how to get the SlObject from it if that's what I need. Any clues on how to get the cell object in the tree hierarchy given that I have the object reference for the com_Object of it?