Possible to get source of a Picture within Silverlight?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Possible to get source of a Picture within Silverlight?

Post by Aracknid » Mon Jun 06, 2011 9:07 pm

When I use the Spy tool to look at various items in my Silverlight control, I notice that the 'images' are showing as type 'Picture', where as in regular HTML images show as 'IMG'. With an IMG I can get the source, but I cannot see how to get the source of the Picture within the Silverlight object. Is this possible?

Thanks,

Aracknid

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

Re: Possible to get source of a Picture within Silverlight?

Post by Support Team » Tue Jun 07, 2011 1:43 pm

Hi,
Aracknid wrote:I notice that the 'images' are showing as type 'Picture', where as in regular HTML images show as 'IMG'.
This is true, because HTML and Silverlight are complete different technologies. Therefore you get a picture in Silverlight and an ImgTag in HTML.

Silverlight
Microsoft Silverlight is an application framework for writing and running browser plug-ins or other rich internet applications, with features and purposes similar to those of Adobe Flash.
HTML
HTML is a markup language that web browsers use to interpret and compose text, images and other material into visual or audible web pages.
Aracknid wrote:but I cannot see how to get the source of the Picture within the Silverlight object. Is this possible?
What do you mean by get the source of the picture? If you want to get the Inner-HTML, you can't get this for a picture. You are only able to get the hashcode.

Regards,
Peter
Ranorex Team

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Possible to get source of a Picture within Silverlight?

Post by Aracknid » Tue Jun 07, 2011 2:33 pm

Aracknid wrote:
but I cannot see how to get the source of the Picture within the Silverlight object. Is this possible?
What do you mean by get the source of the picture? If you want to get the Inner-HTML, you can't get this for a picture. You are only able to get the hashcode.
What I mean by source is the filename. I'm used to using the filename of the image to determine a state. For example, in a grid which is used to represent a "treeview" style layout, with expand/collapse icons and then an icon to represent the type of data (or the level of the tree, such as a folder or a file or an attribute of a file) then followed by text. I can find the picture no problem, but I cannot tell if it is a folder, file, or attribute because I cannot read the filename of the icon.

Thanks,

Aracknid.

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

Re: Possible to get source of a Picture within Silverlight?

Post by Support Team » Tue Jun 07, 2011 11:46 pm

Hi,

you could use image comparison to find out what kind of entry it is.
For that please read the answer to

http://www.ranorex.com/forum/question-r ... t2253.html

Regards,
Roland
Ranorex Support Team

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Possible to get source of a Picture within Silverlight?

Post by Aracknid » Wed Jun 08, 2011 2:30 pm

So for clarity:

1) Is the file name of the Picture not exposed by Silverlight?

or

2) Does Ranorex not support providing file name of Picture in Silverlight container (like SRC for an IMG tag)?

If 2, can I request this be added? It would be most helpful.

Thanks,

Aracknid.

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

Re: Possible to get source of a Picture within Silverlight?

Post by Support Team » Wed Jun 08, 2011 2:40 pm

Aracknid wrote:1) Is the file name of the Picture not exposed by Silverlight?
It is not exposed by UIAutomation, which we use internally to recognize and interact with Silverlight controls.
Aracknid wrote:If 2, can I request this be added? It would be most helpful.
This is currently not technically possible since the underlying technology (UIAutomation) does not support that feature.

If you can change the application, you can as a workaround use another unused UIAutomation property like "HelpText" to make the file name of the picture available to Ranorex. I.e. you additionally assign the used path/file name to the UIAutomation.HelpText property of the picture control and then you can use the Ranorex.UIAutomation.HelpText property to get that value (see the Ranorex User Guide for more information on adapters).

Regards,
Alex
Ranorex Team

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Possible to get source of a Picture within Silverlight?

Post by Aracknid » Wed Jun 15, 2011 6:45 pm

OK, I know I'm coming off as an idiot, but I don't see how to use the Ranorex.UIAutomation.HelpText as you suggest...

In my code, I have something like this:
Dim MyPic as Ranorex.Picture
MyPic = sRXPathToPicture
So I have the Picture element, and when I type "MyPic." the intellisense pop up does not have UIAutomation or HelpText in it.

If I type in "Ranorex.", the intellisense pop up does not have UIAutomation in it.

I'm not sure how to access it.... please help...

Thanks,

Aracknid

P.S.: As an aside I really appreciate all the help you guys provide, but if I could make any suggestions, it would be to have code examples for all the API documentation. I know that is probably a lot of work, but it would probably really be helpful to all your users, especially me :D

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

Re: Possible to get source of a Picture within Silverlight?

Post by Support Team » Thu Jun 16, 2011 2:00 pm

Hi,

Please use following code to get the help text property of UIAutomation
Dim uiaPic As Ranorex.UIAutomation = "yourRxPath"
Dim helpText as String = uiaPic.HelpText
Regards,
Peter
Ranorex Team

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Possible to get source of a Picture within Silverlight?

Post by Aracknid » Thu Jun 16, 2011 2:13 pm

When I type "Ranorex" and then "." (the period), I do not have "UIAutomation" in the popup from VS2010.

Do I need to add a reference to some Ranorex DLL other than the main one? I've got a reference to Ranorex.Core.Dll.

Thanks,

Aracknid

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

Re: Possible to get source of a Picture within Silverlight?

Post by Support Team » Thu Jun 16, 2011 2:42 pm

Sorry I forgot this. You need also the reference Ranorex.Plugin.Wpf. The UIAutomation is nested in this library.

Regards,
Peter
Ranorex Team

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Possible to get source of a Picture within Silverlight?

Post by Aracknid » Thu Feb 02, 2012 10:20 pm

It's been a while, but I'm revisiting this because I was talking to the developer and asked him about providing the filename in the HelpText property, and he looked at me like I had 3 heads.

Long story short, my developers have no idea what UIAutomation is and in their code (they are using .Net 4 C#) the "Image" can only be set to have a source property set, and one other value which I cannot recall. He looked at at Ranorex Spy with me and said he didn't understand why you cannot pass on the filename, because in his development world his development spy tool can.

I guess really what I need is an understanding of telling them how to provide me with what I need. Ranorex UIAutomation is a different "language" than what they are working in and they don't see how to help me...

Any pointers?

Thanks,

Aracknid.

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

Re: Possible to get source of a Picture within Silverlight?

Post by Support Team » Fri Feb 03, 2012 11:01 am

Hi,
Aracknid wrote:I guess really what I need is an understanding of telling them how to provide me with what I need. Ranorex UIAutomation is a different "language" than what they are working in and they don't see how to help me...
Any pointers?
Here is the official MSDN documentation of Microsoft for
UIAutomation:
http://msdn.microsoft.com/en-us/library/ms747327.aspx
UIAutomation Properties:
http://msdn.microsoft.com/en-us/library/ms752056.aspx

Regards,
Peter
Ranorex Team