Sam Oyl
Sam Oyl

Reputation: 381

Replace Window's Background with shadowed Image

I'm looking to replace my solid color background of my window to be an image with a drop shadow.. how can i achieve such thing?

I tried to make the BG transparent and even to null but it didn't show the inside elements..

Upvotes: 0

Views: 63

Answers (1)

Sheridan
Sheridan

Reputation: 69979

It sounds like you need to use the ImageBrush Class. This is like a standard Brush, but it Paints an area with an image instead:

<Window ... >
    <Window.Background>
        <ImageBrush Viewport="0,0,0.5,0.5" TileMode="FlipXY"
            ImageSource="/YourAppName;component/ImageFolderName/ImageName.png" />
    </Window.Background>
<Window>

You can experiment with the TileMode and Viewport settings to get different effects. Please see the linked page from MSDN for more details.

Upvotes: 2

Related Questions