Avalonia中没有虚线框的设定,通过<Border>的VisualBrush设定成虚线
<Border x:Name="myBorder" BorderThickness="1" Margin="20" Padding="5" Width="160" Height="140">
<Border.BorderBrush>
<VisualBrush>
<VisualBrush.Visual>
<Grid>
<Rectangle StrokeThickness="2" Stroke="Gray" StrokeDashArray="4,2"
Width="{Binding Path=Width,ElementName=myBorder}"
Height="{Binding Path=Height,ElementName=myBorder}"/>
</Grid>
</VisualBrush.Visual>
</VisualBrush>
</Border.BorderBrush>
<TextBlock Text="test"/>
</Border>
效果图: