Page 1 of 1

Convert gridView to iList

Posted: Mon May 23, 2011 7:27 pm
by minroNET
Hello,

I am new to Ranorex, so I am sorry if my question is trivial.

I have a grid view collection (at least I think it is a grid view) and I need to iterate over it to access particular elements.

Now, I tried to convert it to IList (I need it to be iterable) but for some reason it does not work. Any ideas what am I doing wrong?

Code:

IList<Ranorex.Row> myRows = COlistOfRows.FindDescendants<Ranorex.Row>();





COlistOfRows is the highlighted element. I am using Ranorex 3.01.

Thank you

Re: Convert gridView to iList

Posted: Mon May 23, 2011 7:35 pm
by Ciege
First, you say it does not work, can you elaborate as to what does not work means to you?

Second, according to the screenshot of Ranorex Spy you have listed there, there are no (visible) Ranorex.Row objects. So searching for all the descendant Ranorex.Row objects or COlistOfRows would return 0, since there are none to be found.

If you look two objects up from COlistOfRows, you see how Ranorex Spy displays a Row object.

Re: Convert gridView to iList

Posted: Mon May 23, 2011 10:31 pm
by Support Team
Hello,

please use the Spy to create a path that lists all your rows. Then use this same path in code like this:
IList<Ranorex.Row> rows = Host.Local.Find("/full/path/to/all/rows/here");
foreach (Ranorex.Row r in rows)
            	r.Click();
Instead of Host.Local you can use the adapter class of a unique containing element together with a relative path to all rows.

Regards,
Roland
Ranorex Support Team