3

I have 2 string variables var1,var 2 .I need to show

For information on returns and exchanges please visit {var 1} or call  {var2}.

any xaml solution available for that?.

2
  • So how you store 2 variables in XAML? Put them in Resources? BTW using StringFormat usually involves Binding here. Commented Oct 20, 2015 at 9:01
  • I use putting my sentence in resources and my variables in viewmodel Commented Oct 20, 2015 at 9:10

1 Answer 1

4

You can use a MultiBinding, like this:

<TextBlock>
    <TextBlock.Text>
        <MultiBinding StringFormat="For information on returns and exchanges please visit {0} or call {1}.">
            <Binding Path="SomeProperty"/>
            <Binding Path="SomeOtherProperty"/>
        </MultiBinding>
    </TextBlock.Text>
</TextBlock>

Note that the SomeProperty and SomeOtherProperty are simple bindings to the DataContext of the TextBlock, such as the View Model or underlying Model.

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.