Binding to TimeSpan
Posted: 29 Jul 2023, 05:09
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:
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.
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:
Code: Select all
<TextBlock Text="{Binding Time.Minutes}"/>