10

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

Johnny Spittle
  • 297
  • 1
  • 9

1 Answers1

15

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.

Justin XL
  • 38,763
  • 7
  • 88
  • 133
  • 2
    So inconvenient, I was so looking forward to this new binding expression. Can't give up design time data hence it'll have to be the old way! I tried something along the lines of: {x:Bind ViewModel.CurrentStyleDefinition.Primary.Color, FallbackValue={Binding CurrentStyleDefinition.Primary.Color}} but it seems the fallback value has to be a simple type :( – FunksMaName Jan 06 '16 at 14:24