UWP X:Bind and Design Time Data

2.2k Views Asked by At

is it possible to use x:bind and design time data in uwp apps?

e.g if I had a textbox that used x:bind to bind to a property on viewmodel in the code behind, should that property's value appear in the textbox in the designer?

is there a way of achieving this?

cheers

Johnny

1

There are 1 best solutions below

1
Justin XL On BEST ANSWER

x:Bind doesn't support design-time data yet. Maybe it never will given it's designed for compile-time bindings to boost performance (I wish it would though).

For simple UI testing purposes, I would add a FallbackValue to the binding expression to force the designer to show me some dummy text. However, don't forget to remove it once you are done with the design.

<TextBlock Text="{x:Bind MyMoney, FallbackValue='$10,000,000'}" />

Update

Now it's easier with the new design-time data support.

<TextBlock Text="{x:Bind MyMoney}" d:Text="$10,000,000" />

Read more from here.