如何在c#中的图像周围有黑色边框.图像存在于包裹面板内
解决方法
只需为图像添加边框:
<toolkit:WrapPanel x:Name="wp"> <Border BorderBrush="Black" BorderThickness="5" > <Image Source="myimage.png" /> </Border> </toolkit:WrapPanel>
var b = new Border { BorderBrush = new SolidColorBrush(Colors.Black),BorderThickness = new Thickness(5) }; var bi = new BitmapImage { UriSource = new Uri("/myimage.png",UriKind.Relative) }; b.Child = new Image {Source = bi}; wp.Children.Add(b);