Freigeben über


Windows Phone StringFormat Binding And Blend

This is a simple, straight-forward walk-through for doing StringFormat binding in Blend. It is meant to go along with my much more comprehensive post on StringFormat binding for Windows Phone.

First, in the Object and Timeline select the TextBlock you want to bind to:

image

Then in the Properties tab on the right side of the screen, go to the Text property and click on little box on the right hand side of the property and select “Create Data Binding…”

image

image

You’ll get a dialog box filled with awesome. If you have the DataContext for your View set to your ViewModel, you’ll see all the bindable properties in your ViewModel and you can just select one of them.

image

click on “More settings” at the bottom and you’ll see a StringFormat editable selection box. You can either type in your StringFormat expression there or select from a list.

image

And that’s it! Now you’ve bound your data and selected the proper StringFormat for it.