KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a TextBlock in my WPF window. <TextBlock> Some <Bold>formatted</Bold> text. </TextBlock> When it is rendered it looks like this, Some formatted text. My question is, can I bind this inline "content" to a resource in my application? I got as far as: Making an application resource string, myText="Some <Bold>formatted</Bold> text." and the following xaml (Some code omitted for brevity) <Window xmlns:props="clr-namespace:MyApp.Properties"> <Window.Resources> <props:Resources x:Key="Resources"/> </Window.Resources> <TextBlock x:Name="Try1" Text="{Binding Source={StaticResource Resources} Path=myText}"/> <TextBlock x:Name="Try2"> <Binding Source="{StaticResource Resources}" Path="myText" /> </TextBlock> </Window> Try1 renders with the tags in place and not effecting formatting. Some <Bold>formatted<Bold> text. Try2 will not compile or render because the resource "myText" is not of type Inline but a string. Is this seemingly simple task possible and if so how?
Tags (comma-separated)
Save Edits
Cancel