更新时间:2021-12-31 08:55:14
只需将图像包裹在边框控件中
Simply wrap the Image in a Border control
<Border BorderThickness="1">
<Image Name="imgPic1"
Width="100"
Height="75"
Stretch="Fill"
VerticalAlignment="Top" />
</Border>
如果您不想在每个图像周围都这样做,您还可以提供一种应用于图像的样式
You could also provide a style you apply to images that does this if you don't want to do it around every image
来自 Pax 添加的答案和评论的最终解决方案:
Final solution from answer and comments added by Pax:
<Border BorderThickness="1"
BorderBrush="#FF000000"
VerticalAlignment="Top">
<Image Name="imgPic1"
Width="100"
Height="75"
Stretch="Fill"
VerticalAlignment="Top"/>
</Border>