<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/"> <Style x:Key="WindowStyle" TargetType="{x:Type Window}"> <Setter Property="WindowChrome.WindowChrome"> <Setter.Value> <WindowChrome CaptionHeight="32" CornerRadius="10" GlassFrameThickness="-1" ResizeBorderThickness="5" UseAeroCaptionButtons="False" /> <!-- GlassFrameThickness="-1" win11上显示异常 --> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Window}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <AdornerDecorator> <ContentPresenter x:Name="win_content" /> </AdornerDecorator> </Border> <ControlTemplate.Triggers> <Trigger Property="WindowState" Value="Maximized"> <!-- 调整边框 --> <Setter TargetName="win_content" Property="Margin" Value="5,5,5,5" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="WindowWithCorderStyle" TargetType="{x:Type Window}"> <Setter Property="WindowChrome.WindowChrome"> <Setter.Value> <WindowChrome CaptionHeight="48" CornerRadius="15" GlassFrameThickness="-1" ResizeBorderThickness="5" UseAeroCaptionButtons="False" /> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Window}"> <Border Margin="20" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Effect="{StaticResource shadow.black-2-2}"> <Grid> <!-- esc关闭窗体按钮 --> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" IsCancel="True" /> <AdornerDecorator> <ContentPresenter x:Name="win_content" /> </AdornerDecorator> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="WindowState" Value="Maximized"> <!-- 调整边框 --> <Setter TargetName="win_content" Property="Margin" Value="5,5,5,5" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- 弹窗的窗体样式 --> <Style x:Key="DialogWindowStyle" BasedOn="{StaticResource WindowWithCorderStyle}" TargetType="{x:Type Window}"> <Setter Property="WindowStyle" Value="None" /> <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterOwner" /> <Setter Property="SizeToContent" Value="WidthAndHeight" /> <Setter Property="ShowInTaskbar" Value="False" /> <Setter Property="ResizeMode" Value="NoResize" /> <Setter Property="Padding" Value="0" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush"> <Setter.Value> <SolidColorBrush Opacity="0.3" Color="Gray" /> </Setter.Value> </Setter> <Setter Property="Background" Value="Transparent" /> </Style> </ResourceDictionary>