问题
In WPF, I know that for TextBlock when I want to append some "dynamic" string to a string I can do something like the following :
<TextBlock>
<Run Text ="static string"/>
<Run Text="{Binding dynamicstring}"/>
</TextBlock>
However, the same method doesn't work for TextBox, is there anyway to do the same thing with TextBox
回答1:
Try using RichEditBox.
<RichEditBox>
<Paragraph>
<Run Text="Static Text" />
<Run Text="{Binding Dynamic}" />
</Paragraph>
</RichEditBox>
If you're using Windows Phone Silverlight
<RichTextBox>
<Paragraph>
<Run Text="Static Text" />
<Run Text="{Binding Dynamic}" />
</Paragraph>
</RichTextBox>
来源:https://stackoverflow.com/questions/32977054/how-can-i-add-run-text-xx-to-textbox-c-or-how-can-i-append-dynamic-string