WPF Object Data Context

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 1
Joined: Mon Feb 06, 2017 8:44 pm

WPF Object Data Context

Post by rperneel » Mon Feb 06, 2017 8:49 pm

Hi All,

I am evaluating the possibility of changing from TestComplete to Ranorex and have a seemingly simple question. We have a WPF application, and I am trying to get access to the various UI object's data context variable. In the Spy tool I see a reference to the DataContext, but it is greyed out, and is listing ByRef<CLASSNAME>..... (See attached image)

Is there a way that I can get access to the datacontext in the spy? or is there a way in usercode I can get access? (have been using Ranorex for ~3 days)

You do not have the required permissions to view the files attached to this post.

User avatar
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: WPF Object Data Context

Post by odklizec » Tue Feb 07, 2017 12:13 pm


A similar problem to yours has been discussed here:
http://www.ranorex.com/forum/casting-fr ... tml#p39450
Sadly, there is most probably no out-of-the-box solution. I would suggest to contact Ranorex support at [email protected] and request a sample code mentioned in that post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration