Alex Rivera | Logout

Transparent background goes black in WPF

Asked 2011-11-11T13:56:08.813
36

I try to create a window with rounded corner. I set Window background to transparent and set the border background to white. However on the region between the border and the window, I get black background instead of transparent.

I develop on C# WPF, VS2010 on Window 7. Below is my XAML and Screenshot.

XAML:

<Window WindowStyle="None" Background="Transparent">
    <Border BorderBrush="Black" BorderThickness="1" CornerRadius="25" Background="White">
        <Grid>
            ... some content ...
        </Grid>
    </Border>
</Window>

Screenshot: enter image description here

Edit
Report

1 Answer

72

You also need to set AllowsTransparency="True" on your Window tag to use a Transparent Window Background

<Window WindowStyle="None" 
        Background="Transparent" 
        AllowsTransparency="True">

</Window>
answered 2011-11-11T14:02:32.060

Your Answer