473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

WPF and Underline Text in a label in C#?

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?

Oct 10 '08 #1
2 41956
BartMan wrote:
Thanks for any suggestions?
Try:
http://msdn.microsoft.com/en-us/libr...underline.aspx

--
Thank you,

Christopher Ireland

"There is only one thing a philosopher can be relied upon to do, and that is
to contradict other philosophers."
William James

Oct 10 '08 #2
>
http://msdn.microsoft.com/en-us/libr...underline.aspx

Thanks! That is eactly what I needed! :)
Oct 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: FrodoBaggins | last post by:
Dear Team, I am trying to use stylesheets on a web form. Initially, I created a folder named 'styles' within the WebUI project. In this I created the following stylesheet named...
2
by: Hareth | last post by:
i got the idea "form.textbox.text = label.text" from vb... i tried it in C# but it generated errors i found a diff example from :...
1
by: basulasz | last post by:
I want to add a mouseover attribute on a label which is in a template column. For example the label will be underlined on mouseover event. How can i do that? Thanks... -- basulasz
1
by: Menü Sargut | last post by:
Hey there, How can I set the BorderColor from a text Label (FixedSingle) Thanks for any help.
2
by: John A Grandy | last post by:
when using StringBuilder to build-up a block of text (which is then assigned to a Label control) is it possible to underline a portion of the text ? it would seem that...
5
by: Yohan Blurp | last post by:
Hi, Here is sample page to show you the problem : <html><body> <form action="/cgi-bin/test.cgi" method="post"> Data Path : <input type="text" size="50" value="C:\Test Data\May 2007.xls"...
3
by: bhanubalaji | last post by:
hi, I am unable to disable the text(label) in javascript..it's working fine with IE,but i am using MOZILLA.. can any one help regarding this.. What's the wrong with my code? I am...
2
damonreid
by: damonreid | last post by:
Is it possible to pass a field to a text label when a form loads? I have tried Private Sub Form_Load() Dim textName As String textName = "Text Edit Text" Me.Text29 =...
1
by: kenneth6 | last post by:
Windows form app: 1. how to get text label updated? 2. how to get text label assigned with a variable value (integer / string)?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.