XAML centering text in a richtextbox

so i have a rich text box and i do the following:

rtbDisplay.Document.Blocks.Clear(); rtbDisplay.Document.Blocks.Add(new Paragraph.(new Run("text here"))); //following line doesn't work rtbDisplay.TextAlignment = TextAlignment.Center; 

and i'm trying to follow: http://ift.tt/1G9lHlO


FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content..."))); // Text will be centered. flowDoc.TextAlignment = TextAlignment.Center; 

i kind of understand why i can't do it since flowDoc is a generated object or something?

by icebbyice via /r/csharp

Leave a Reply