Set Text value for TextBlock : TextBlock « UI Controls « Silverlight






Set Text value for TextBlock

Set Text value for TextBlock
    

<UserControl x:Class='SilverlightApplication3.MainPage'
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>
    <Grid>
            <TextBlock Foreground="DarkGray" 
                       VerticalAlignment="Center" 
                       HorizontalAlignment="Center"
                      
                       Text="this is a test"/>
    </Grid>
    
</UserControl>

   
    
    
    
  








Related examples in the same category

1.Implements the x:Name Attribute to a TextBlock and Button ElementImplements the x:Name Attribute to a TextBlock and Button Element
2.Creating a TextBlockCreating a TextBlock
3.To specify if the text should wrap to the next line if it is wider than the Width propertyTo specify if the text should wrap to the next line if it is wider than the Width property
4.Bind data to TextBlock
5.Implements a TextBlock to Display Key Data Captured from a TextBox ControlImplements a TextBlock to Display Key Data Captured from a TextBox Control
6.Scaled textScaled text
7.skewed textskewed text
8.TextBlock wrapping exampleTextBlock wrapping example
9.TextBlock alignment exampleTextBlock alignment example
10.TextBlock formatting exampleTextBlock formatting example
11.Animates the text block's colorAnimates the text block's color
12.Animates the text block's opacity(fading text)Animates the text block's opacity(fading text)
13.Animates the text block's widthAnimates the text block's width
14.Default underline decorationDefault underline decoration
15.Default baseline decoration
16.Default overline decoration
17.TextBlock VerticalAlignment
18.Add TextBlock into a GridAdd TextBlock into a Grid
19.Use RenderTransform to transform a TextBlockUse RenderTransform to transform a TextBlock
20.Set Margins for TextBlock in Grid ResourceSet Margins for TextBlock in Grid Resource
21.Set TextWrapping to True for TextBlockSet TextWrapping to True for TextBlock
22.Set Foreground color for TextBlockSet Foreground color for TextBlock
23.Add Border to TextBlockAdd Border to TextBlock
24.TextBlock with DropShadowEffectTextBlock with DropShadowEffect
25.A basic TextBlock in actionA basic TextBlock in action
26.A TextBlock with Inline elementsA TextBlock with Inline elements
27.Setting the Foreground of a TextBlock at design timeSetting the Foreground of a TextBlock at design time
28.Underlining text in a TextBlock.Underlining text in a TextBlock.
29.Wrapping text within a TextBlockWrapping text within a TextBlock
30.Moving a TextBlock 5 pixels at a time by using the GetValue and SetValue methodsMoving a TextBlock 5 pixels at a time by using the GetValue and SetValue methods
31.To display a paragraph of text, you can use the TextBlock elementTo display a paragraph of text, you can use the TextBlock element
32.To introduce additional paragraphs, you can use the LineBreak element:To introduce additional paragraphs, you can use the LineBreak element:
33.Use Line break to add new line to TextBlockUse Line break to add new line to TextBlock
34.Use Run to control the font style for TextBlockUse Run to control the font style for TextBlock
35.Set current time to TextBlockSet current time to TextBlock
36.A basic TextBlock using the Canvas element Left and Top attached propertiesA basic TextBlock using the Canvas element Left and Top attached properties
37.The effects of the Padding property on a TextBlockThe effects of the Padding property on a TextBlock
38.Adding a rounded rectangle background to a TextBlock elementAdding a rounded rectangle background to a TextBlock element
39.Use a gradient to paint TextBlockUse a gradient to paint TextBlock
40.Reference static resource for TextBlockReference static resource for TextBlock
41.Set font size and font family for TextBlock
42.Set foreground color to green for TextBlockSet foreground color to green for TextBlock
43.Zoom a TextBlockZoom a TextBlock
44.Put Button and TextBlock to CanvasPut Button and TextBlock to Canvas
45.Put Run block to TextBlockPut Run block to TextBlock
46.Inherited formattingInherited formatting
47.Gradient textGradient text