WPF date readed as different format

Ask general questions here.
jindrich.matous
Posts: 5
Joined: Wed Apr 05, 2017 9:39 am

WPF date readed as different format

Post by jindrich.matous » Tue Jul 04, 2017 9:13 am

Hallo,
The datetime is displayed in WPF form differently than in spy window.

WPF definition:
<Label Name="lblValidFrom" Grid.Column="1" Content="{Binding IssuersInformation.ValidFrom}" Style="{StaticResource h3}" ContentStringFormat="dd.MM.yy HH:mm:ss" />

see in attachment...

This is how I need to parse it. ActiveCILValidFrom is repository item.
Ranorex.Text from = TechOpsApplication_Toll_Context_ValidationRepository.Instance.TechnicalOppAppl.ActiveCILValidFrom;
dt = System.DateTime.ParseExact(from.TextValue, "M/d/yyyy h:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture);

it is correct?

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

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

Re: WPF date readed as different format

Post by odklizec » Tue Jul 04, 2017 9:22 am

Hi,

Please upload a Ranorex snapshot (not screenshot) of the problematic element. Also, you forgot to mention Ranorex version! There were done some major changes related to WPF in Ranorex 7.0. Also, have you tried other WPF-related settings (in Ranorex settings >> Plugins tab >> WPF section)?

Anyway, I'm not quite sure what exactly is your problem? According to your post, you trying to obtain datetime in different format than is defined in given WPF element, but then you mention Spy shows something different? So what exactly is the problem? The datetime output you get from ParseExact or just the Spy interpretation?
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