silverlight - Ampersand in XAML -


when set text property of rolestextname codebehind in silverlight5 app doing:

rolestextname.text = "david &amp; goliath";   <textblock textwrapping="wrap">         <span fontweight="bold">roles:</span>         <span><run x:name="rolestextname" /></span> </textblock> 

problem: don't & symbol, actual text.

xaml used create object graph represents user interface. when modify user interface setting property values in code xaml has been processed , no longer used. should not xaml specific encoding when modifying object graph code. encoding required in xaml because based on xml , need way represents characters &, < , > unambgiously.

so executing

rolestextname.text = "david &amp; goliath"; 

will set text of run to

 david &amp; goliath 

to achieve want execute code insted:

rolestextname.text = "david & goliath"; 

Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -