Windows Phone 8.1 TextBlock

network | | 访问(43)
<StackPanel x:Name="stackPanel">
    <TextBlock x:Name="TextBlock2" FontSize="20" Height="30" Text="你好,我是TextBlock控件" Foreground="Red" ></TextBlock>
    <TextBlock FontSize="20">
        <TextBlock.Inlines>
            <Run  FontWeight="Bold" FontSize="14" Text="TextBlock. " />
            <Run FontStyle="Italic" Foreground="Red" Text="red text. " />
            <Run FontStyle="Italic" FontSize="18" Text="linear gradient text. ">
                <Run.Foreground>
                    <LinearGradientBrush>
                        <GradientStop Color="Green" Offset="0.0" />
                        <GradientStop Color="Purple" Offset="0.25" />
                        <GradientStop Color="Orange" Offset="0.5" />
                        <GradientStop Color="Blue" Offset="0.75" />
                    </LinearGradientBrush>
                </Run.Foreground>
            </Run>
            <Run FontStyle="Italic" Foreground="Green" Text=" green " />
        </TextBlock.Inlines>
    </TextBlock>
    <TextBlock FontSize="20">         
                    你好!
                    <LineBreak/>
                    我是TextBlock
                    <LineBreak/>
                    再见
                    <LineBreak/>
                    --2014年6月8日
    </TextBlock>
    <TextBlock TextWrapping="Wrap" FontSize="30">         
                    好像内容太长长长长长长长长长长长长长长长长长长了
    </TextBlock>
    <TextBlock FontSize="20">         
                    好像内容太长长长长长长长长长长长长长长长长长长了
    </TextBlock>
    <TextBlock Text="颜色变变变变变变" FontSize="30">
        <TextBlock.Foreground>
            <LinearGradientBrush>
                <GradientStop Color="#FF0000FF" Offset="0.0" />
                <GradientStop Color="#FFEEEEEE" Offset="1.0" />
            </LinearGradientBrush>
        </TextBlock.Foreground>
    </TextBlock>
</StackPanel>
public MainPage() {
    this.InitializeComponent();
    TextBlock txtBlock = new TextBlock();
    txtBlock.Height = 50;
    txtBlock.Width = 200;
    txtBlock.FontSize = 18;
    txtBlock.Text = "在CS页面生成的TextBlock";
    txtBlock.Foreground = new SolidColorBrush(Colors.Blue);
    stackPanel.Children.Add(txtBlock);

}