silverlight - Ampersand in XAML -
when set text property of rolestextname codebehind in silverlight5 app doing:
rolestextname.text = "david & 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 & goliath";
will set text of run to
david & goliath
to achieve want execute code insted:
rolestextname.text = "david & goliath";
Comments
Post a Comment