Benjin
Benjin

Reputation: 2409

How to preview what a XAML control with bound values looks like

I'm writing an app in XAML, and I'm using binding for getting values to the UI layer. I'd like to see what my control will look like while making changes to the XAML, but because the data values are bound, many areas show up as blank (which, in turn, messes up the relative layout).

Is there any way to give XAML values to use for rendering the control review without replacing the Binding directives?

Upvotes: 2

Views: 288

Answers (2)

Parag
Parag

Reputation: 543

You can also use design time data to see how your xaml works. You just need to add new class that will be treated as design time view model. Its more elegant way to test xaml at design time.

Upvotes: 2

macieqqq
macieqqq

Reputation: 373

Maybe you can set TargetNullValue or FallbackValue property in your binding, example:

  <TextBlock Text="{Binding NotExsitOrNullPropertyName, TargetNullValue=SomeDefaultValue, FallbackValue=SomeDefaultValue}" ></TextBlock>

Hope it hepls.

Upvotes: 1

Related Questions