Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border around image in c#

How to have a black border around image in c#.the image exists inside a wrap panel

like image 755
Shaireen Avatar asked Dec 23 '10 09:12

Shaireen


People also ask

What is Border_constant?

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.

How will you add border to an image class 10?

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.


1 Answers

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);
like image 174
Matt Lacey Avatar answered Oct 12 '22 20:10

Matt Lacey