Xaml TextBlock set round corner

Ajay picture Ajay · Aug 21, 2013 · Viewed 25.6k times · Source

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.

Answer

Dennis picture Dennis · Aug 21, 2013

Use Border:

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