c# - How to assign a Run to a text property, programmatically? -
i know in xaml can do...
<textblock fontsize="18"> text <linebreak/> <run fontsize="24" fontweight="bold">my big bold text</run> </textblock> question is, how can assign run text (string) property, programmatically?
if @ textblock see contentproperty set inlines
[localizability(localizationcategory.text), contentproperty("inlines")] public class textblock : frameworkelement, ... this means add inline elements property inlines everyting added between opening , closing tag of textblock.
so c# equivalent xaml is
textblock textblock = new textblock(); textblock.fontsize = 18; textblock.inlines.add("this text"); textblock.inlines.add(new linebreak()); run run = new run("my big bold text"); run.fontsize = 24; run.fontweight = fontweights.bold; textblock.inlines.add(run);
Comments
Post a Comment