Skip to main content

Microsoft Silverlight

Answered Question how to put "&" in TextBlock?RSS Feed

(0)

rich_r26
rich_r26

Member

Member

27 points

101 Posts

how to put "&" in TextBlock?

 

  None of these works, suggestion is appreciated.

<TextBlock  Text="Message & View"/>

<TextBlock  Text="Message &amp; View"/>

<TextBlock  Text="Message &#38;View"/>

mepfuso
mepfuso

Member

Member

683 points

151 Posts

Re: how to put "&" in TextBlock?

 

  

this.myTextBlock.Text = "Message & View";

 

Stick out tongue

...: Between the iron gates of fate, the seeds of time were sown :...

Bill Reiss
Bill Reiss

Contributor

Contributor

4836 points

917 Posts

Silverlight MVP
Answered Question

Re: how to put "&" in TextBlock?

&amp; works for me


Bill Reiss, Coauthor of Hello! Silverlight 3
My blog (rss feed)

MarkTap
MarkTap

Participant

Participant

1442 points

263 Posts

Re: how to put "&" in TextBlock?

I didn't see a Silverlight docs page for this, but the WPF page is http://msdn.microsoft.com/en-us/library/aa970677.aspx, and all the same symbols seem to work in Silverlight:

        <TextBlock Text="&lt;" />
        <TextBlock Text="&gt;" />
        <TextBlock Text="&amp;" />
        <TextBlock Text="&quot;" />

rich_r26
rich_r26

Member

Member

27 points

101 Posts

Re: Re: how to put "&" in TextBlock?

I guess is becuase of the way the xaml (contains the is TextBlock) is loaded.

This happens when the xaml string is loaded through:

mayControl : Control;

mayControl  (){

base.Template = (ControlTemplate)XamlReader.Load(theXamlString);;

base.ApplyTemplate();  <== failed at this.

}

 

FuryDiamond
FuryDiamond

Contributor

Contributor

3820 points

766 Posts

Answered Question

Re: how to put "&" in TextBlock?

<TextBlock Text="Message &amp; View" />

Please "Mark as Answer" if this post answered your question. :)
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities