Is there a way to change color and font for some part of text which I want to put on TextBox or RichTextBox. I am using C# WPF.
For example
richText
You can try out this.
public TestWindow()
{
InitializeComponent();
this.paragraph = new Paragraph();
rich1.Document = new FlowDocument(paragraph);
var from = "user1";
var text = "chat message goes here";
paragraph.Inlines.Add(new Bold(new Run(from + ": "))
{
Foreground = Brushes.Red
});
paragraph.Inlines.Add(text);
paragraph.Inlines.Add(new LineBreak());
this.DataContext = this;
}
private Paragraph paragraph;
So use the Document property of the RichTextBox