I am building a RichTextBox in my codebehind. Here is some simple code I'm trying to make work:
FlowDocument mcFlowDoc = new FlowDocument();
Paragraph para = new Paragraph();
para.Inlines.Add(new Bold(new Run("Hello World")));
mcFlowDoc.Blocks.Add(para);
RichTextBox mcRTB = new RichTextBox();
mcRTB.Width = 560;
mcRTB.Height = 280;
mcRTB.Document = mcFlowDoc;
mcRTB.SelectAll();
tbDirections.Text += mcRTB.Selection.Text;
Here is my xaml for tbDirections:
<TextBlock
Margin="0,0,8,0"
Name="tbDirections"
Text="My driving directions..." TextWrapping="Wrap" />
So "Hello World" does appear at the end of my TextBlock tbDirections but it's not bold. I am a WPF newbie. What am I doing wrong?