Getting cell value in Dev Express Grid

Ask general questions here.
vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Getting cell value in Dev Express Grid

Post by vengaishiva » Fri Mar 11, 2011 11:47 am

Hi,
I am using Dev Express wpf grid im my application. I want to track a particular cell value of the grid. I used Ranorex spy which gives the cell's path as 'unknown' element. How can i get the value inside the cell?
Thanks,
Siva R S

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Fri Mar 11, 2011 11:50 am

Hi,

Please can you post us a Ranorex Snapshot of the entire data grid?
How to create a Snapshot
And please let me know which value you want to validate or automate,
then I will provide you an RxPath to the element.

Regards,
Peter
Ranorex Team

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Getting cell value in Dev Express Grid

Post by vengaishiva » Fri Mar 11, 2011 12:31 pm

Hi,
I have attached the snapshot with this. The gridcontrol1 in snapshot is a devexpress wpf datagrid. The rxpath of a cell in the grid is of type 'unknown'. I want to extract the value from the cell. How can it be done?
Thanks,
Siva R S
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Fri Mar 11, 2011 1:24 pm

Hi,

Thank you for the Snapshot.
I tried DevExpress 9.1.4 and it is working out of the box. I get a "Text element" from this data grid, where you can see the value of the cell.
Which version of DevExpress is in use on your site?
Have you implemented this control by your own? If yes, maybe you have something forgotten to implement.

See attached Snapshot
DevExpressSnap.rxsnp
Regards,
Peter
Ranorex Team
You do not have the required permissions to view the files attached to this post.

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Getting cell value in Dev Express Grid

Post by vengaishiva » Mon Mar 14, 2011 7:38 am

Hi,
I am using version 10.2 of dev express grid. I have bind the datagrid to BindingList of C#. When i use ranorex spy to select a cell, it always returns me an unknown type. How can i get the text value from the selected cell?
Thanks,
Siva R S

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Mon Mar 14, 2011 8:01 pm

We will have a look at the 10.2 version of the grid. This is probably an issue with the UIAutomation implementation of the grid, which is provided by DevXPress.

Michael
Ranorex Team

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Getting cell value in Dev Express Grid

Post by vengaishiva » Tue Mar 15, 2011 11:18 am

Hi Michael,
Waiting for your results :cry:

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Tue Mar 15, 2011 3:54 pm

Hi,

it seems to be a limitation of the control from DevExpress. But you can use following workaround, until we add this special pattern to our software, in order that you have access to it without using code. This fix will be available in the next release of Ranorex.

First of all you have to add following references to your project
  • UIAutomationClient
  • UIAutomationTypes
Then please change the target framework to ".NET Framework 3.0". This setting can be changed using the project properties. You will find the target framework under the "Compiling" tab.

Now you have to adapt your code:
  • Add following to your using statements:
    using System.Windows.Automation;
  • With this piece of code you should get the property value of your item.
    UIAutomation uia = "yourRxPathToTheElement";
    string value = (string)uia.AutomationElement.GetCurrentPropertyValue(ValuePattern.ValueProperty);
BTW, sometimes even we need a little bit more time to find a solution. :wink:

Regards,
Peter
Ranorex Team

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Getting cell value in Dev Express Grid

Post by vengaishiva » Tue Mar 15, 2011 4:21 pm

Hi,
Thanks for the reply. But I cannot get the class UIAutomation as you mentioned. I have included all the references and changed the target framework to 3.0. There is a class called Automation and AutomationElement. How to get UIAutomation class and instantiate with the RxPath as you mentioned?
Thanks
Siva R S

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Tue Mar 15, 2011 4:33 pm

Hi,

Please check your references if the Ranorex.Plugins.WPF reference is available.
If not please add it do your references and try it again.

Regards,
Peter
Ranorex Team

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Getting cell value in Dev Express Grid

Post by vengaishiva » Wed Mar 16, 2011 12:29 pm

Hi,
Thanks for the reply. It really worked. But our application is targetting .NET 3.5 framework. So i cannot use that solution. Is it possible to use GDI plugin for ranorex to get the value from grid cell?. I tried with this link http://www.ranorex.com/blog/automation- ... n#more-926. But it didn't work. Any idea?
Thanks,
Siva

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Wed Mar 16, 2011 12:46 pm

Hi,
vengaishiva wrote:But our application is targetting .NET 3.5 framework. So i cannot use that solution
You don't need to change the target framework of your application (AUT). Just change the Ranorex project to .Net 3.0 or 3.5 Framework. By the way, 3.5 includes the 3.0 framework.
vengaishiva wrote: Is it possible to use GDI plugin for ranorex to get the value from grid cell?
You cannot use the GDI Plug-In for WPF, because the drawing engine is completely different.

Regards,
Peter
Ranorex Team

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Getting cell value in Dev Express Grid

Post by vengaishiva » Thu Mar 24, 2011 4:38 pm

Hi,
Thanks for your reply. I am using ranorex 2.3 now. The UIAutomation class does not contain the property AutomationElement. Is there any workaround for it?
Regards,
Siva R S

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Getting cell value in Dev Express Grid

Post by Support Team » Fri Mar 25, 2011 11:25 am

Hi,

Sorry, but this class was added with Ranorex 3.0 and isn't available in Ranorex 2.3. So the only chance to use this feature is to upgrade to Ranorex 3.0.

Regards,
Peter
Ranorex Team