WPF and Underline Text in a label in C#?

B

BartMan

Greetings,

I have a Label object defined in WPF xaml like the following:
<Label Margin="0,5,0,17" Name="labelTestMsg">
<TextBlock >
<Underline >My Test Message</Underline>
</TextBlock>
</Label>

My question is I want to set the text in the label dynamically in C#, and so
it also has the underline option.

If I set my label's content to like the following in my C# code:
labelTestMsg.Content = "Changed Message";

It wipes out the underline option of the text.
How do I build the equivalent in C# code, so the text is still underlined?

Thanks for any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top