How to get a border around text element with auto-width/height in Silverlight + padding – Education Career Blog

What I have at the moment is only defined width:

<Grid>
        <Rectangle Fill="#FFF5F7F9" HorizontalAlignment="Left" Height="80" Stroke="#FF565656" VerticalAlignment="Top" Width="128" RadiusY="15" StrokeThickness="3" RadiusX="15"/>
        <TextBlock HorizontalAlignment="Left" Height="47" TextWrapping="Wrap" Text="Draft" VerticalAlignment="Top" Width="106" FontSize="32" FontStyle="Italic" FontFamily="Verdana" Margin="20,21,0,0"/>
</Grid>

Something equivalent to html like (just for example):

<div style="display:inline;border:solid 3px #000;padding:3px">
   Some text here
</div>

,

Found it… sry for the very noob question.

<Border
            BorderThickness="2"
            BorderBrush="Black"
            Background="AliceBlue"
            HorizontalAlignment="Left"
            VerticalAlignment="Top" Padding="10">

                <TextBlock>Hello World!</TextBlock>

        </Border>

Leave a Comment