Code to traverse through wpfgrid and click on the wpfimage for the corresponding in Coded UI

Hi,
I have a wpf application which has wpftable having columns as name, type, created date, modified date and an image. (On click on this image, edit and delete button will be displayed for each row).
I am trying to do edit and delete operations for a row by giving input as the name as name is unique. I need coded ui test method  to traverse through this wpftable identify the row with the name provided, click on the image and select edit or delete
options.
Please refer the screenshot below:
Please anyone provided me code for this in c# for coded ui test. Because for the wpfimage properties added in my respository are very less. Hence facing this issue.
Thanks in advance.
Regards,
G.Madhavi

Sure Edward.
Below is the method I have used. As I have already described the input for my method is the WpfTable, the name for which I need to perform edit or delete options and columnindex (this is used because I need to click on the image. And I have such similar
tables across the application and want to reuse the method. The rowindex changes based on the input name but the columnindex would be same).
Please refer the screenshot above forbetter understanding.
public boolVerifyEditing(WpfTableTargetTable, stringName, string columnIndex)
             bool searchRes = false;
             int rowIndex = 0;
             foreach (WpfRow UIRow in TargetTable.Rows)
                 foreach (UITestControl cell in UIRow.Cells as UITestControlCollection)
                     var cellcontents = cell.GetChildren();
                     foreach (var content in cellcontents)
                         WpfText wpfText = content as WpfText;
                        if (wpfText!= null && wpfText.DisplayText.Equals(Name, StringComparison.OrdinalIgnoreCase))
                             cell.Container = TargetTable;
                            cell.SearchProperties.Add(WpfCell.PropertyNames.RowIndex, rowIndex.ToString());
                            cell.SearchProperties.Add(WpfCell.PropertyNames.ColumnIndex, columnIndex);
                            var contents = cell.GetChildren();
                            foreach (var child in contents)
                                 WpfImage image = child as WpfImage;
                                 Mouse.Click(image);
                                 searchRes = true;
                                 break;
                             if (searchRes)
                                 break;
                     if (searchRes)
                         break;
                 if (searchRes)
                     break;
                 rowIndex++;
             return searchRes;
I will use this method, which clicks on the row for which I need to perform edit or delete operations. Then I click on Edit or delete button.
This suffices my requirement. Hope this helpothershaving same issue.
Regards,
Madhavi

Similar Messages

Maybe you are looking for

  • Keynote and Square simultaneously?

    Can I use the iPad to run a Keynote presentation AND run other aps at the same time?  Specifically, I want to use my iPad to run a keynote presentation and ALSO use Square to run credit card charges without disrupting the slide show.   Possible?

  • How can I use/access files inside an invisible folder?

    I am struggling to get Stylus RMX to show the user libraries option and am discovering that the Lion installer put all the files (8GB) into the Macintosh HD/Users/Library/Application Support/Spectrasonics/SAGE folder, but I cannot see the Macintosh H

  • How can I use "write to spreadsheet" during the data is taking but not the end of all the loops

    Hi, I have to run an experiment on Labview 6 or 5. I don't have Labview 7 on that computer for some reason. My experiment is talking about 1000 hours, and I have a probelm on storing the data. Right now I am using "Write to spread sheet" and I set th

  • Why doesn't uprgrade from 10.2 to Tigerr work?

    When I try installing Tiger as soon as the installation gets to "verifying destinatin volumes" it stops and I get "errors installing software, try again." What is supposed to be simple upgrade is now a mystery. In addition to the RAM that came instal

  • Flash crashes scrpt error

    On my website at www.godsmarines.com, the website works fine on my domain server, but when opening in D/wcs3 and previewing in a browser I get a error message statine flash has crashed and another saing script error. Just happened 2 days ago but was