Search code examples
c#xamlwindows-phone-7windows-phone-8textblock

Xaml TextBlock set round corner


I am trying to set rounded corner of TextBlock in xaml. But there is no such property.

<Grid x:Name="grdDis" Grid.Row="1">
        <TextBlock Text="Description" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Name="txtDescription" Margin="18,10,0,0" Height="128" Width="445"/>
</Grid>

How can I set rounded corner of TextBlock. And also want to set Background color of TextBlock.


Solution

  • Use Border:

        <Border Margin="5" Padding="5" BorderThickness="1" BorderBrush="Red" Background="AntiqueWhite" CornerRadius="10">
            <TextBlock Text="Lorem ipsum"/>
        </Border>
    

    Result:

    enter image description here