Default value at design time XAML

Sherlock picture Sherlock · Jun 20, 2013 · Viewed 13.6k times · Source

I have a binded TextBlock, XAML:

<TextBlock Text="{Binding MyText}"/>

I know the FallbackValue can be used if the Binding isn't available, but this happens at run time ? Is there any way to show a default value at design time ? It would make things easier if I could see a value when designing my windows instead of an empty TextBlock.

Thanks

Answer

Scroog1 picture Scroog1 · Jun 25, 2013

Update: Visual Studio 2019 v16.7

You can now do:

<TextBlock Text="{Binding MyText}" d:Text="Design time value"/>

If you would prefer a less verbose version of Ian Bamforth's answer, you can just do

<TextBlock Text="{Binding MyText, FallbackValue=None}"/>