How to have a black border around image in c#.the image exists inside a wrap panel
BORDER_CONSTANT: Pad the image with a constant value (i.e. black or 0. BORDER_REPLICATE: The row or column at the very edge of the original is replicated to the extra border.
Step 1: Open the document containing the picture to which you want to add a border. Step 2: Click the picture once to select it. Step 2: Click the Format tab under Picture Tools at the top of the window. Step 3: Click the Picture Border button in the Picture Style section of the navigational ribbon.
Just add a border to the Image:
<toolkit:WrapPanel x:Name="wp">
<Border BorderBrush="Black" BorderThickness="5" >
<Image Source="myimage.png" />
</Border>
</toolkit:WrapPanel>
Or add it to the WrapPanel in code:
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With