Hello,
Welcome to Microsoft Q&A!
Draw border with dotted line.
Those which can draw dotted lines need to inherit from the Shape class, but the Border inherits from FrameworkElement. So you can't draw a Border with dotted line.
But Rectangle for example cant carry any context.
Rectangle can't add any child content, as a simple workaround, you can put the Rectangle and TextBlock in a Grid, let the TextBlock overlay on the Rectangle. For example:
<Grid Width="200" Height="200">
<Rectangle StrokeDashArray="1.0 1.0"
Stroke="Red"
StrokeThickness="2"
Width="200" Height="200">
</Rectangle>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">hello</TextBlock>
</Grid>