1

Can i write something like this in WPF(i know that this piece of code is wrong, but need to know if there is kind of this construct):

<TextBlock Height="50" Text="Test: {Binding Path=MODULE_GUID}" />


Or always to add some text to binding value i must do something like this:

<StackPanel Orientation="Horizontal">
   <TextBlock Height="50" Text="Test: " />
   <TextBlock Height="50" Text="{Binding Path=MODULE_GUID}" />
</StackPanel>

3 Answers 3

7

Starting with .NET 3.5 SP1, you can use:

<TextBlock Height="50" Text="{Binding Path=MODULE_GUID, StringFormat='Test: {0}'}" />
Sign up to request clarification or add additional context in comments.

Comments

2

You can use StringFormat in the Binding

Comments

1

Simply use string format in Binding

<TextBlock Text="{Binding Path=MODULE_GUID, StringFormat='Your Text Goes Here {0}'}" />

Remember {0} must be there.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.