Files
Shrlalgo.RvKits/WPFluent/Controls/MessageWindow/MessageWindow.xaml
2025-05-05 17:04:06 +08:00

173 lines
10 KiB
XML

<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFluent.Controls">
<Style TargetType="{x:Type controls:MessageWindow}">
<Setter Property="MaxWidth" Value="450" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{DynamicResource MessageBoxBackground}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{DynamicResource MessageBoxForeground}" />
<Setter Property="TextElement.FontWeight" Value="Regular" />
<Setter Property="WindowStyle" Value="ToolWindow" />
<Setter Property="ShowInTaskbar" Value="False" />
<!--<Setter Property="AllowsTransparency" Value="False" />-->
<Setter Property="RenderOptions.BitmapScalingMode" Value="Fant" />
<Setter Property="ResizeMode" Value="NoResize" />
<Setter Property="WindowState" Value="Normal" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<!--
CaptionHeight removes the white block at the top of the application window.
GlassFrameThickness must be at least -1, otherwise the transparency for Mica will not work.
-->
<WindowChrome
CaptionHeight="1"
CornerRadius="0"
GlassFrameThickness="-1"
NonClientFrameEdges="None"
ResizeBorderThickness="0"
ResizeGripDirection="None"
UseAeroCaptionButtons="False" />
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:MessageWindow}">
<Grid Background="{TemplateBinding Background}">
<AdornerDecorator>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.RowSpan="2" Background="{DynamicResource MessageBoxTopOverlay}" />
<TextBlock
x:Name="Title"
Grid.Row="0"
Margin="12,12,12,0"
FontWeight="SemiBold"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Title}" />
<controls:TitleBar
Grid.Row="0"
ShowMaximize="False"
ShowMinimize="False" />
<ContentPresenter
x:Name="ContentPresenter"
Grid.Row="1"
Margin="12,10,12,12"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}">
<ContentPresenter.Resources>
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
<Setter Property="TextAlignment" Value="Justify" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
<Border
Grid.Row="2"
Padding="12"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
BorderBrush="{DynamicResource MessageBoxSeparatorBorderBrush}"
BorderThickness="0,1,0,0"
CornerRadius="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="PrimaryColumn" Width="*" />
<ColumnDefinition x:Name="FirstSpacer" Width="8" />
<ColumnDefinition x:Name="SecondaryColumn" Width="*" />
<ColumnDefinition x:Name="SecondSpacer" Width="8" />
<ColumnDefinition x:Name="CloseColumn" Width="*" />
</Grid.ColumnDefinitions>
<controls:Button
Grid.Column="0"
HorizontalAlignment="Stretch"
Appearance="{TemplateBinding PrimaryButtonAppearance}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:MessageWindow}}, Path=TemplateButtonCommand, Mode=OneTime}"
CommandParameter="{x:Static controls:MessageBoxButton.Primary}"
Content="{TemplateBinding PrimaryButtonText}"
Icon="{TemplateBinding PrimaryButtonIcon}"
IsDefault="True" />
<controls:Button
Grid.Column="2"
HorizontalAlignment="Stretch"
Appearance="{TemplateBinding SecondaryButtonAppearance}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:MessageWindow}}, Path=TemplateButtonCommand, Mode=OneTime}"
CommandParameter="{x:Static controls:MessageBoxButton.Secondary}"
Content="{TemplateBinding SecondaryButtonText}"
Icon="{TemplateBinding SecondaryButtonIcon}" />
<controls:Button
Grid.Column="4"
HorizontalAlignment="Stretch"
Appearance="{TemplateBinding CloseButtonAppearance}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:MessageWindow}}, Path=TemplateButtonCommand, Mode=OneTime}"
CommandParameter="{x:Static controls:MessageBoxButton.Close}"
Content="{TemplateBinding CloseButtonText}"
Icon="{TemplateBinding CloseButtonIcon}"
IsCancel="True" />
</Grid>
</Border>
</Grid>
</AdornerDecorator>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter TargetName="ContentPresenter" Property="Margin" Value="8" />
</Trigger>
<Trigger Property="IsPrimaryButtonEnabled" Value="False">
<Setter TargetName="PrimaryColumn" Property="Width" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsPrimaryButtonEnabled" Value="False" />
<Condition Property="IsSecondaryButtonEnabled" Value="False" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="SecondSpacer" Property="Width" Value="0" />
</MultiTrigger.Setters>
</MultiTrigger>
<Trigger Property="IsSecondaryButtonEnabled" Value="False">
<Setter TargetName="FirstSpacer" Property="Width" Value="0" />
<Setter TargetName="SecondaryColumn" Property="Width" Value="0" />
</Trigger>
<Trigger Property="PrimaryButtonText" Value="">
<Setter Property="IsPrimaryButtonEnabled" Value="False" />
</Trigger>
<Trigger Property="SecondaryButtonText" Value="">
<Setter Property="IsSecondaryButtonEnabled" Value="False" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter Property="BorderThickness" Value="6,6,6,0" />
<Setter Property="Topmost" Value="False" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>