Use LayoutTransform to transform a TextBlock


   
     

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel>
  <Button>
    <TextBlock>
      <TextBlock.LayoutTransform>
        <ScaleTransform ScaleX="3" ScaleY="3" />
      </TextBlock.LayoutTransform>
      Foo bar
    </TextBlock>
  </Button>
</StackPanel>
</Page>

   
    
    
    
    
     


Set Margins for TextBlock in Grid Resource


   
     

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  HorizontalAlignment="Center" VerticalAlignment="Stretch">

<Grid ShowGridLines="True">
  <Grid.Resources>
    <Style TargetType="TextBlock">
      <Setter Property="Margin" Value="5,3" />
    </Style>
  </Grid.Resources>

  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition />
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="2*" />
    <RowDefinition Height="1*" />
  </Grid.RowDefinitions>
  <TextBlock Grid.Column="0" Grid.Row="0">Key:</TextBlock>
  <TextBlock Grid.Column="1" Grid.Row="0">Value</TextBlock>
  <TextBlock Grid.Column="0" Grid.Row="1">A:</TextBlock>
  <TextBlock Grid.Column="1" Grid.Row="1">a</TextBlock>
  <TextBlock Grid.Column="0" Grid.Row="2">B:</TextBlock>
  <TextBlock Grid.Column="1" Grid.Row="2">b</TextBlock>

</Grid>



</Page>

   
    
    
    
    
     


Use a GroupBox control to create a container for a TabControl.


   
 

<Page x:Class="GroupBoxExample.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="OnLoad" Name="GroupBoxPage">

    <DockPanel>
        <GroupBox Width="300" Height="410">
            <GroupBox.Header>
                <Label>Title of the GroupBox</Label>
            </GroupBox.Header>
            <StackPanel>
                <TabControl Name="myTabControl" TabStripPlacement="Top" Margin="0, 0, 0, 10" Height="350">
                    <TabItem Name="PersonalInfo">
                        <TabItem.Header>_Personal</TabItem.Header>
                        <StackPanel>
                            <TextBlock>Employee</TextBlock>
                            <TextBlock>Select your name</TextBlock>
                            <ListBox Name="empName" SelectionChanged="updateSummary">
                                <ListBoxItem IsSelected="true">A</ListBoxItem>
                                <ListBoxItem>B</ListBoxItem>
                                <ListBoxItem>C</ListBoxItem>
                                <ListBoxItem>D</ListBoxItem>
                            </ListBox>
                        </StackPanel>
                    </TabItem>
                    <TabItem>
                        <TabItem.Header>_Job</TabItem.Header>
                        <StackPanel>
                            <TextBlock>Select a job</TextBlock>
                            <ListBox Name ="job" SelectionChanged="updateSummary">
                                <ListBoxItem IsSelected="true">A</ListBoxItem>
                                <ListBoxItem>B</ListBoxItem>
                                <ListBoxItem>C</ListBoxItem>
                                <ListBoxItem>D</ListBoxItem>
                            </ListBox>
                        </StackPanel>
                    </TabItem>
                    <TabItem Name="Summary" >
                        <TabItem.Header>Su_mmary</TabItem.Header>
                        <StackPanel>
                            <TextBlock Name="emp"/>
                            <TextBlock Name="ejob"/>
                            <TextBlock Name="eskill"/>
                        </StackPanel>
                    </TabItem>
                </TabControl>
                <Button Content="Show Summary" Click="goToSummaryTab"/>
            </StackPanel>
        </GroupBox>
    </DockPanel>
</Page>

//File:Window.xaml.cs

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GroupBoxExample
{
    public partial class Page1 : Page
    {
        private void displayData()
        {
            ListBoxItem lbi = empName.SelectedItem as ListBoxItem;
            emp.Text = "Name: " + lbi.Content.ToString();
            lbi = job.SelectedItem as ListBoxItem;
            ejob.Text = "Job: " + lbi.Content.ToString();
            eskill.Text = "Skill: " + lbi.Content.ToString();
        }
        private void OnLoad(object sender, RoutedEventArgs e)
        {
            displayData();
        }
        private void updateSummary(object sender, RoutedEventArgs e)
        {
            if (GroupBoxPage.IsLoaded)
                displayData();
        }
        private void goToSummaryTab(object sender, RoutedEventArgs e)
        {
            displayData();
            Summary.IsSelected = true;
        }
    }
}

   
     


TextBlock VerticalAlignment


   
     

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="TextDecorationExample.Window1"
  Title="TextDecoration Example"
  Width="720"
  Height="400">
  <StackPanel>
      <TextBlock 
        FontSize="24" 
        Width="180" 
        VerticalAlignment="Center" 
        TextDecorations="OverLine">The lazy dog</TextBlock>
  </StackPanel>
</Window>

   
    
    
    
    
     


Emboss Text


   
     



<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontFamily" Value="Times New Roman" />
            <Setter Property="FontSize" Value="144" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
    </Grid.Resources>

    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>

    <TextBlock Foreground="{DynamicResource 
                    {x:Static SystemColors.GrayTextBrushKey}}">
        Emboss
        <TextBlock.RenderTransform>
            <TranslateTransform X="2" Y="2" />
        </TextBlock.RenderTransform>
    </TextBlock>


    <TextBlock Foreground="{DynamicResource 
                    {x:Static SystemColors.WindowBrushKey}}">
        Emboss
    </TextBlock>


</Grid>

   
    
    
    
    
     


Engrave Text


   
     



<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontFamily" Value="Times New Roman" />
            <Setter Property="FontSize" Value="144" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
    </Grid.Resources>

    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>


    <TextBlock Grid.Row="1" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}">
        Engrave
        <TextBlock.RenderTransform>
            <TranslateTransform X="-2" Y="-2" />
        </TextBlock.RenderTransform>
    </TextBlock>


    <TextBlock Grid.Row="1" Foreground="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
        Engrave
    </TextBlock>


</Grid>