Page 1 of 1

Binding to TimeSpan

Posted: 29 Jul 2023, 05:09
by JayOfAllTrades
I'll be brief because I know you guys are flooded with help requests.

Inside my view model I expose a TimeSpan for an in-game countdown timer. I created three text blocks which bind to the TimeSpan.Minutes, Seconds, and Milliseconds. In Wpf it works, but in Unity I get this error.

[NOESIS/W] Can't solve PropertyPath: Type 'TimeSpan' does not contain a property named 'Minutes'
[NOESIS/E] Binding failed: Path=Time.Minutes, Source=Testing.TimerTestViewModel(''), Target=TextBlock('')


I got identical errors for the seconds and the milliseconds. The xaml for the textblock is simply:
<TextBlock Text="{Binding Time.Minutes}"/>
This is the second time I've had an issue identical to this, so this time I'm reaching out so that I can find out what I'm doing wrong and avoid this mistake in the future.

Re: Binding to TimeSpan

Posted: 31 Jul 2023, 14:09
by sfernandez
Hi, we are not exposing those members in our native TimeSpan, could you please report it in our bugtracker? We will add it for the next release.

Re: Binding to TimeSpan

Posted: 31 Jul 2023, 21:43
by JayOfAllTrades
Done! :) #2657

Also, is there any way I can verify implementation details like that in the future should I run into this problem again? The docs looked like they showed TimeSpan as having these properties when I had checked. Is that just a small mistake on the docs, or did I misreading it?

Re: Binding to TimeSpan

Posted: 01 Aug 2023, 11:45
by sfernandez
Thanks for the report!
Also, is there any way I can verify implementation details like that in the future should I run into this problem again? The docs looked like they showed TimeSpan as having these properties when I had checked. Is that just a small mistake on the docs, or did I misreading it?
The docs should be the correct source of reference, this was just a bug in our code.