This is a migrated thread and some comments may be shown as answers.

RadGridView / UI Automation

3 Answers 181 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hassan
Top achievements
Rank 1
Hassan asked on 18 Apr 2012, 03:17 PM
Hi,
I do manage to execute a number of action with UI Automation against a radGridView such as:
 - Creating a new row
- Reading the content of a cell
But I really don't understand how one could write in a cell. Using Snoop, I can see that before you select a cell, its underlying control is a TextBlock and only when you click on the cell, you get a TextBox. Which automation patterns do you use to click on a given cell?
My goal is to simulate a click on the cell, the get access to the underlying TextBox in order to change its content.
Please let me know if this can be done.

Thank you in advance,
Hassan

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 20 Apr 2012, 01:08 PM
Hello Hassan,
  1. The easiest way to add a new row in a RadGridView utilizing its automation tree is to use the GridViewNewRowAutomationPeer instance and use the IInvokeProvider.Invoke() method.
  2. GridViewCell's automation peer implements the IValueProvider automatation pattern, so that you can use the IValueProvider.SetValue method, as long as the respective cell is in edit mode.

As a side note, please let me ask you to confirm which version of RadControls you are currently using.

All the best,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Hassan
Top achievements
Rank 1
answered on 26 Apr 2012, 02:33 PM
you wrote:

"GridViewCell's automation peer implements the IValueProvider automatation pattern, so that you can use the IValueProvider.SetValue method, as long as the respective cell is in edit mode."

That's the problem, I can't find how to click on the cell programmatically (which object/pattern) to make it editable. Instead, I only get a Textblock when I expect a TextBox.
Regards,
Hassan

0
Accepted
Ivan Ivanov
Telerik team
answered on 27 Apr 2012, 10:59 AM
Hello,

With the current version you can accomplish this through GridViewCellAutomationPeer's Owner. However, as this might not be a good solution for all the possible scenarios, we will implement IInvokeProvider on the GridVIewCellAutomationPeer type, so that no visual tree elements are involved in the process. This change should be available with our next Q release.

Regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
GridView
Asked by
Hassan
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Hassan
Top achievements
Rank 1
Share this question
or