WPF Window with transparent background containing opaque controls [duplicate]
Instead of setting the opacity of the window, set its background's opacity:
<Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" WindowStyle="None"> <Window.Background> <SolidColorBrush Opacity="0.5" Color="White"/> </Window.Background> <Grid> <Button Width="200" Height="50">button</Button> </Grid></Window>
If you create a style like this:
<Window.Resources> <Style TargetType="Button" x:Key="WindowButtons"> <Setter Property="Opacity" Value="1"/> </Style></Window.Resources>
Then you can reference those in the XAML for your button like this:
<Button Style="{StaticResource WindowButtons}">Tony</Button>
And it should no longer inherit it's opacity from its parent.