<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Yuyue.WPF.Themes"> <ControlTemplate x:Key="WindowBaseControlTemplate" TargetType="{x:Type Window}"> <Grid> <Border Background="#6699ff" CornerRadius="6" Opacity="0.2" /> <Border x:Name="borderBg" Margin="3" Background="#4F535D" CornerRadius="5" > <Grid> <Grid.RowDefinitions> <RowDefinition Height="28" /> <RowDefinition /> </Grid.RowDefinitions> <Border x:Name="TitleBar" CornerRadius="5,5,0,0"> <Grid Background="#FFFFFF"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image HorizontalAlignment="Left" Source="{Binding TitleImageBrush, RelativeSource={RelativeSource TemplatedParent}}" /> <WrapPanel Grid.Column="1" HorizontalAlignment="Right"> <Button x:Name="btnMinimize" Style="{DynamicResource MinimizeButtonStyle}" /> <Button x:Name="btnMaximize" Style="{DynamicResource MaximizeButtonStyle}" /> <Button x:Name="btnClose" Style="{DynamicResource CloseButtonStyle}" /> <Button x:Name="btnClose1" Style="{DynamicResource MaximizeButtonStyle}" /> <Button x:Name="btnClose2" Style="{DynamicResource MaximizeButtonStyle}" /> </WrapPanel> </Grid> </Border> <Grid x:Name="gridContent" Grid.Row="1"> <ContentPresenter /> </Grid> </Grid> </Border> </Grid> </ControlTemplate> <Style x:Key="WindowBaseStyle" TargetType="{x:Type Window}"> <Setter Property="Template" Value="{StaticResource WindowBaseControlTemplate}" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="WindowStyle" Value="None" /> </Style> </ResourceDictionary>
试试AllowTransparency="True"