What is the typical pattern for displaying an "unavailable" value when databinding in WPF?
For example I am using MVVM, and TextBlock
s in my view are bound to my viewmodel's properties, some of which are int
s. There are times when I want to temporarily display two dashes ("--") in my view rather than the property value.
I could change the property to be a string, and then in the getter add some logic to specify whether it returns the value or "--". This is probably the appropriate way to use MVVM, but are there any easier ways?
Is there a way to take advantage of a TextBlock
's FallbackValue
? Or is there another approach for temporarily suspending databinding and displaying a "unavailable" value?