Zarkos
Zarkos

Reputation: 457

WPF Image Border

I have this Image:

ArrowImage

I want the image to have a border If I do:

<Border BorderThickness="1" BorderBrush="Black" HorizontalAlignment="Right" Width="22" VerticalAlignment="Center">
            <Image Source="/<AppName>;component/Images/Background/Achtergrond_Arrow.png" HorizontalAlignment="Right" Width="22" >
                <Image.Effect>
                    <DropShadowEffect Color="#FF868686" Direction="0" ShadowDepth="0" BlurRadius="10"  />
                </Image.Effect>
            </Image>
        </Border>

it gives a Square border, not following the arrow itself.

Square Image

Does anybody have any idea on how to fix this??

Upvotes: 1

Views: 3852

Answers (3)

Zarkos
Zarkos

Reputation: 457

My solution:

<Path Fill="Black" Data="M 0 44 L 22 22 L 0 0 Z"  HorizontalAlignment="Right" VerticalAlignment="Center" Width="22" >
        <Path.Effect>
            <DropShadowEffect Color="#FF868686" Direction="0" ShadowDepth="0" BlurRadius="10"  />
        </Path.Effect>
    </Path>

I threw the arrow image away.

Thanks anyway

Upvotes: 1

Emond
Emond

Reputation: 50672

The Border in WPF is always rectangular.

If you want an outline you will have to draw it or use an effect

Upvotes: 1

Youp Bernoulli
Youp Bernoulli

Reputation: 5635

Don't use an image but draw the border and triangle yourself. You can use a Path, a Line and other basic geometric shapes for this.

This post may give you a starting point. Or a Petzold blog post can give you further assistance.

Upvotes: 3

Related Questions