Write text inside shapes using Border control in wpf

We know that WPF Shapes (such as ellipse,rectangle etc) are not container control, so we can put some text directly inside them or we will have to work extra for doing that but we can do this with the help of Border control very easily. I am trying to show this with the following example:

Write text on the shape in WPF


<Window x:Class="Window1"
    Title="Window1" Height="258" Width="580">
        <Border CornerRadius="80" Background="#ffffff" BorderBrush="#2a3b57" 
                BorderThickness="5" Height="77" Margin="164,39,218,0" 
                Name="Border1" VerticalAlignment="Top" >
            <TextBlock Background="#ffffff" HorizontalAlignment="Center"
                       VerticalAlignment="Center" Height="34" Width="69"
                Welcome to AuthorCode

In the following example we are using CornerRadius property of the Border, you can set this property as you wish. Suppose if you want to show text in rectangle, just remove the property or if you want to show text inside Rounded rectangle then you can set CornerRadius property to 20 or 30 as your requirement.
We are using HorizontalAlignment=”Center” and VerticalAlignment=”Center” properties of TextBlock for centering text in the shape.