1 TextBlock Simple Example Application
<GridBackground="{ThemeResource Applicationpagebackgroundthemebrush}"> <grid.rowdefinitions> <RowDefinitionHeight= "Auto"/> <RowDefinitionHeight="*"/> </grid.rowdefinitions> <StackPanelx:name= "Titlepanel"Grid.Row= "0"Margin= "12,35,0,28"> <TextBlockText= "My Application"FontSize= " the" /> <TextBlockText= "TextBlock"FontSize= "$" /> </StackPanel> <Gridx:name= "Contentpanel"Grid.Row= "1"Margin= "12,0,12,0"> <StackPanelx:name= "StackPanel"> <TextBlockx:name= "TextBlock2"FontSize= " the"Height= "+"Text= "Hello, I am TextBlock control"Foreground= "Red" ></TextBlock> <TextBlockFontSize= " the"> <TextBlock.Inlines> <RunFontWeight= "Bold"FontSize= "+"Text= "TextBlock." " /> <RunFontStyle= "Italic"FontSize= "+"Text= "linear gradient text. "> <Run.foreground> <LinearGradientBrush> <GradientStopColor= "Green"Offset= "0.0" /> <GradientStopColor= "Purple"Offset= "0.25" /> <GradientStopColor= "Orange"Offset= "0.5" /> <GradientStopColor= "Blue"Offset= "0.75" /> </LinearGradientBrush> </Run.foreground> </Run> <RunFontStyle= "Italic"Foreground= "Green"Text= "Green" /> <SpanForeground= "Green">Span</Span> </TextBlock.Inlines> </TextBlock> <TextBlockFontSize= " the">Hi there! <LineBreak/>I'm TextBlock .<LineBreak/>Goodbye<LineBreak/>--June 8, 2014</TextBlock> <TextBlocktextwrapping= "Wrap"FontSize= " the">It seems that the content is too long, long long and long length long longer long</TextBlock> <!--texttrimming-Text overflow display mode Texttrimming.none-do not do any processing texttrimmin G.wordellipsis-At the border, use ellipses instead of the remaining text - <TextBlockFontSize= " the"HorizontalAlignment= "Left"Text= "How text is displayed when overflow"Width= "$"texttrimming= "WordEllipsis" /> <TextBlockText= "COLOR variable variable variable"FontSize= "+"> <Textblock.foreground> <LinearGradientBrush> <GradientStopColor= "#FF0000FF"Offset= "0.0" /> <GradientStopColor= "#FFEEEEEE"Offset= "1.0" /> </LinearGradientBrush> </Textblock.foreground> </TextBlock> <!--frameworkelement.flowdirection-Specifies the flow direction of text or interface elements within their parent elements flowdirection.lefttoright -content flows from left to right (default) Flowdirection.righttoleft-content flows from right to left - <TextBlockFontSize= "+"HorizontalAlignment= "Left"Text= "flow from right to left"Width= "$"flowdirection= "RightToLeft" /> <TextBlockFontSize= "+"HorizontalAlignment= "Left"Text= "flow from left to right"Width= "$"flowdirection= "LeftToRight" /> <TextBlockFontSize= "+"Name= "Lblsource"istextselectionenabled= "True"selectionchanged= "Txt_selectionchanged_1"> <TextBlock.Inlines> <Run>Test whether text can be selected</Run> </TextBlock.Inlines> </TextBlock> </StackPanel> </Grid> </Grid>
The TextBlock of the WindowsPhone control