Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 569
Alias Varghese Avatar asked Mar 17 '26 08:03

Alias Varghese


1 Answers

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.

like image 89
Mike Eason Avatar answered Mar 18 '26 22:03

Mike Eason



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!