Windows 8 Store Apps Learning (1) Text control

Source: Internet
Author: User
Tags xmlns

TextBlock, TextBox, PasswordBox, riched

Introduced

Re-imagine the Windows 8 Store Apps Text control

TextBlock-Text Display box

TextBox-Text input Box

PasswordBox-Password input box

Richeditbox-Rich Text edit box

Richtextblock-Rich Text display box

Richtextblockoverflow-Overflow text display box

Example

1, TextBlock's Demo

Textblockdemo.xaml

<page x:class= "XamlDemo.Controls.TextBlockDemo" xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/present ation "xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "xmlns:local=" Using:XamlDemo.Controls "xmlns:d=" H ttp://schemas.microsoft.com/expression/blend/2008 "xmlns:mc=" http://schemas.openxmlformats.org/ markup-compatibility/2006 "mc:ignorable=" D "> <grid background=" Transparent "> <st Ackpanel margin= "0 0 0" > < the text displayed for common properties of the TextBlock If special words such as quotes need to use the corresponding HTML encoding--> <textblock text= "TextBlock &quot; Common Properties &quot;" 

Textalignment= "left" foreground= "Blue" fontfamily= "Microsoft Ya Hei" fontsize= "fontweight=" "Bold" fontstyle= "Italic" Fontstretch= "Normal" textwrapping= "Wrap"/> <!--characterspacing-for setting characters Spacing specific character interval pixel calculation formula is as follows: Font size * CharacterspaciNg value/1000 = character spacing pixel value lineheight-row high linestackingstrategy-policy for controlling row heights MaxHeight-The row height of each row is based on the Lineheight value and the maximum of the natural row high school for each row. Default value blocklineheight-the row height per row is lineheight, with a character range as the reference Baselinetobaseline- The row height of each row is based on the Lineheight value, with a reference to the baseline (what is a baseline: The baseline for the English character is essentially the same as the 3rd line in the 4 line of the word) Inlines-the collection of inline elements. Includes span, bold, italic, underline, and so on, but InlineUIContainer is not available, it needs to be used in Richtextblock--> &L T TextBlock fontsize= "characterspacing=" linestackingstrategy= "MaxHeight" lineheight= "> &L" T textblock.inlines> <run foreground= "Red" >Run</Run> <span F Oreground= "Green" >Span</Span> <linebreak/> <bold>bold& Lt;/bold> <Italic>Italic</Italic> <Underline>Underline</underline> </TextBlock.Inlines> </TextBlock>   
                    <!--texttrimming-display mode when text overflows Texttrimming.none-no processing Texttrimming.wordellipsis-At the boundary, replace the remaining text with an ellipsis--> <textblock fontsize= "24"   
       
            Horizontalalignment= "left" text= "abcdefghijklmnopqrstuvwxyz" width= "texttrimming=" wordellipsis <!--frameworkelement.flowdirection-Specifies the direction in which text or interface elements flow in their parent element flowdire Ction.   
            LeftToRight-content flows from left to right (default) Flowdirection.righttoleft-content flows from right to left-->   
       
            <textblock fontsize= "horizontalalignment=" "left" text= "ABCDEFG" "width=" flowdirection= "RightToLeft"/> <!--istextselectionenabled-whether the text can be selected--> ; TextBlock FontsizE= "Name=" "Lblsource" istextselectionenabled= "True" selectionchanged= "Txt_selectionchanged_1" > ;   
                    textblock.inlines> <Run>abcdefg</Run> <linebreak/> <Run>hijklmn</Run> <linebreak/> <r un>opqrst</run> </TextBlock.Inlines> </TextBlock> &L t;! --Display the text selected by the user in the Lblsource (the binding here does not work, it should be a bug, so the concrete implementation is put into the CS)--> <textblock fontsize= "Name=" Te xt= "{Binding selectedtext, elementname=lblsource}"/> </StackPanel> </Grid> </page& Gt

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.