Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

displaying special charecter in TextBlock control. RSS

3 replies

Last post Aug 31, 2009 08:43 AM by neal.gabriel

(0)
  • rajeevsys@live.com

    rajeevsys@li...

    Member

    2 Points

    6 Posts

    displaying special charecter in TextBlock control.

    Aug 31, 2009 08:15 AM | LINK

    I have a rss which has following tag,I read all SubHeading Name and bind it to a Silverlight TextBlock control,In texblock Special Charecter(&) is also displaying currently. I want to display & in place of &, < in place of < and all this type of cherecter. I want to know, how i can solve it.
  • neal.gabriel

    neal.gabriel

    Contributor

    4520 Points

    789 Posts

    Re: displaying special charecter in TextBlock control.

    Aug 31, 2009 08:27 AM | LINK

    Use 

    <TextBlock Text="This &amp; that"/>

    Regards...

    Neal Gabriel
    Follow me on twitter
    My Blog
  • rajeevsys@live.com

    rajeevsys@li...

    Member

    2 Points

    6 Posts

    Re: displaying special charecter in TextBlock control.

    Aug 31, 2009 08:34 AM | LINK

    i have a cs code string str = "test & That"; test.Text = str; I want to display the above string str as follows test & That
  • neal.gabriel

    neal.gabriel

    Contributor

    4520 Points

    789 Posts

    Re: Re: displaying special charecter in TextBlock control.

    Aug 31, 2009 08:43 AM | LINK

    The methods I tried include

    <TextBlock Text="{Binding MySpecialChar}"/>

    private string _mySpecialChar;public string MySpecialChar

    {

    get { return _mySpecialChar; }

    set { _mySpecialChar = value; }

    }

    MySpecialChar = "This & that";

    ----- This Worked fine -----

    <TextBlock x:Name="lblSpecialChar"/>

    lblSpecialChar.Text = "This & that";

    ---- Even this worked fine;

    <TextBlock x:Name="lblSpecialChar"/> 

    string
    strSpecialChar = "This & that";

    lblSpecialChar.Text = strSpecialChar;

     --- This too worked fine. ..

     

    Regards...

    Neal Gabriel
    Follow me on twitter
    My Blog