C
C
crescent2019-12-06 13:59:56
WPF
crescent, 2019-12-06 13:59:56

Window transparency in wpf?

Can't make a transparent window in wpf

<Window x:Class="Gui.TestWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Gui"
        mc:Ignorable="d"
        Opacity="0.5" >

    <StackPanel>

        <Button Width="100" Height="40">AAA</Button>

    </StackPanel>
    
</Window>

How to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Space Purr, 2019-12-06
@crescent

Add property AllowTransparency="True" and WindowsStyle="None"

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" Opacity="0.5" AllowsTransparency="True" 
        WindowStyle="None">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question