Alias Varghese
Alias Varghese

Reputation: 2172

string formating using 2 strings in wpf xaml solution

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?.

Upvotes: 3

Views: 874

Answers (1)

Mike Eason
Mike Eason

Reputation: 9713

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.

Upvotes: 4

Related Questions