Silverlight: How to access rows/columns in Datagrid : Object Identification and Technologies

Silverlight: How to access rows/columns in Datagrid

Technology specific object identification, supported applications, web technologies, and 3rd party controls.

Silverlight: How to access rows/columns in Datagrid

Postby rekha1234 » Fri Jul 22, 2011 9:28 pm

Hi,

I am new to Ranorex and Automating Silverlight applications. I am supposed to automate clicking on a row in the the Datagrid based on its column value. Below are some details of the Datagrid

Ranorex Path: /dom[@domain='00.00.000.00']/body/form/div[@id='silverlightControlHost']/object/form/tabpagelist[6]/tabpage/table[@automationid='dg_Files']

AutomationID: dg_Files
ClassName:DataGrid
Frameworkid:Silverlight
IsContentElemet True
IsControlElement True

Can someone please guide me on how to instantiate the data grid and access elements in that
Attachments
Untitled.png
Untitled.png (43.74 KiB) Viewed 541 times
rekha1234
 
Posts: 6
Joined: Fri Jul 22, 2011 9:12 pm

Re: Silverlight: How to access rows/columns in Datagrid

Postby Support Team » Mon Jul 25, 2011 12:44 pm

Hi,

Please could you post us a Ranorex Snapshot of the DataGrid. With this snapshot it is much easier to analyze your issue.
How to create a Ranorex Snapshot

Thanks in advance.

Regards,
Peter
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Silverlight: How to access rows/columns in Datagrid

Postby rekha1234 » Mon Jul 25, 2011 8:52 pm

Hi Peter,

Thanks for replying. Please find the snapshot attached as requested
Attachments
DataGridSnapshot.rxsnp
snapshot
(442.94 KiB) Downloaded 31 times
rekha1234
 
Posts: 6
Joined: Fri Jul 22, 2011 9:12 pm

Re: Silverlight: How to access rows/columns in Datagrid

Postby Support Team » Tue Jul 26, 2011 4:33 pm

rekha1234 wrote:Can someone please guide me on how to instantiate the data grid and access elements in that

From the snapshot this task looks pretty straight forward. Ranorex does not identify the cells correctly as such (they only show up as "Element", not as "Cell"), but still you can get to all data within them.
The children of the "RowsPresenter" element represent the rows in the datagrid, i.e. the elements with name "System.ComponentModel.CheckableItem...". The children of the elements representing the rows are the actual cells of the grid, again containing elements for the content of the cells. Your code could look like the following:
Ranorex.Table table = "pathToTable";
IList<Ranorex.UIAutomation> rows = table.Find<UIAutomation>(
    "element[@automationid='RowsPresenter']/element");
// get cells of first row
IList<Ranorex.UIAutomation> cellsInFirstRow = rows[0].Find<UIAutomation>("element");

Regards,
Alex
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Silverlight: How to access rows/columns in Datagrid

Postby rekha1234 » Fri Jul 29, 2011 9:52 pm

Thanks alot for the Reply. Suggested code worked!!

Regards,
Rekha
rekha1234
 
Posts: 6
Joined: Fri Jul 22, 2011 9:12 pm


Return to Object Identification and Technologies

Who is online

Users browsing this forum: No registered users and 0 guests

cron