1

In my XAML binding in a Silverlight App, I wrote something like this:

Text="{Binding TestSomething}"

TestSomething returns a number. Now I want to make a sentence out of it, for example something like:

"We found this many XYZ results"

where XYZ is equal to that TestSomething

How can I combine string.Format with the binding above to generate the sentence that I need.

1 Answer 1

4

You can use the StringFormat binding specification:

Text="{Binding Path=TestSomething, StringFormat=We found this many {0} results}"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.