Possible Duplicate:
Can I have multiple colors in a single TextBlock in WPF?
Is it possible to style sections of a WPF TextBlock, such as a certain word to be bold, italic or underlined? Can you change all font properties? If so, what solution is the prettiest and most performance effective?
You can style runs individually within a TextBlock in XAML, or you can use the
Inlinesproperty in your .cs codebehind file. This blog post indicates that you can style at least font style, font weight, foreground color, and font size.XAML:
And here’s an example showing adding a brush to the run from C# Corner:
The
Inlinescollection you can access programmatically is a collection ofSystem.Windows.Documents.Runobjects.