I'm trying to draw a dotted border around a button, however the border doesn't appear. Not sure what I'm doing wrong here, can you please help?
My Xaml code:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid Background="Ivory">
<Border Width="101" Height="31">
<Border.BorderBrush>
<VisualBrush>
<VisualBrush.Visual>
<Rectangle StrokeThickness="1" Stroke="Red" StrokeDashArray="1 2"/>
</VisualBrush.Visual>
</VisualBrush>
</Border.BorderBrush>
<Button Width="100" Height="30">
Focus Here</Button>
</Border>
</Grid>
</Page>
Note: The immediate issue was with border thickness, but still the dotted border is not appearing even after adding borderthickness.
BorderThickness
to greater than 0?StrokeThickness
is the brushes stroke,BorderThickness
on the border determines visibility as far as I know – CrasisRectangle
dimensions to the same as the border. May be something to do with the rectangles size? – Crasis