<TextBlock>
<Run Text="Make only the word"/>
<Run FontWeight="Bold" Text=" bold "/>
<Run Text="appear in"/>
<Run FontWeight="Bold" Text="bold"/>
</TextBlock>
If you want to do that in code, that's quite a lot of work...
TextBlock tb = new TextBlock();
Run run1 = new Run() { Text = "Only make the word " };
Run run2 = new Run() { Text = "bold", FontWeight = FontWeights.Bold };
Run run3 = new Run() { Text = " appear in " };
Run run4 = new Run() { Text = "bold", FontWeight = FontWeights.Bold };
tb.Inlines.Add(run1);
tb.Inlines.Add(run2);
tb.Inlines.Add(run3);
tb.Inlines.Add(run4);
Notice :
Class Run's Text is not DependencyProperty. So you can't Binding into this Property.
No comments:
Post a Comment