Binding TextBlock to styled text in code?
WCF and WF
3
Posts
2
Posters
3
Views
1
Watching
-
I want to duplicate this XAML code but I want to dynamically create the text in C#.
<TextBlock>
<Run Background="Blue">Text1</Run>
<Run Background="Red">Text2</Run>
</TextBlock>How are the Runs added to the TextBox?
-
I want to duplicate this XAML code but I want to dynamically create the text in C#.
<TextBlock>
<Run Background="Blue">Text1</Run>
<Run Background="Red">Text2</Run>
</TextBlock>How are the Runs added to the TextBox?
Add the Run objects to the TextBlock.Inlines collection.
-
Add the Run objects to the TextBlock.Inlines collection.
How do I bind to Inlines? According to the docs it seems to be read-only. Do I need to switch to a Label or Textbox?