简体   繁体   中英

Appending String While Databinding in Silverlight xaml Question

I have a control which accepts a string but when displaying it i want to append "Hello" to that string right in xaml how do i do it?

You can bind to the property and use the StringFormat:

<TextBlock Text=”{Binding Path=UserName, StringFormat=’Hello \{0\} ’}“/>

Some more info can be found here: http://www.designersilverlight.com/2010/05/28/silverlight-4-binding-and-stringformat-in-xaml/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM