296 lines
15 KiB
XML
296 lines
15 KiB
XML
<Window x:Class="MainShell.Common.View.MwMessageBoxWindow"
|
|
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
xmlns:common="clr-namespace:MainShell.Common"
|
|
xmlns:behaviors="clr-namespace:MainShell.Common.Behaviors"
|
|
mc:Ignorable="d"
|
|
MinWidth="360"
|
|
MinHeight="220"
|
|
MaxWidth="720"
|
|
SizeToContent="WidthAndHeight"
|
|
ResizeMode="NoResize"
|
|
WindowStartupLocation="CenterScreen"
|
|
AllowsTransparency="True"
|
|
WindowStyle="None"
|
|
Background="Transparent"
|
|
ShowInTaskbar="False"
|
|
Title="{Binding State.Caption}"
|
|
FlowDirection="{Binding State.WindowFlowDirection}"
|
|
UseLayoutRounding="True"
|
|
SnapsToDevicePixels="True"
|
|
common:WindowService.DialogResult="{Binding DialogResult}">
|
|
<Window.Resources>
|
|
<Style x:Key="MwMessageBoxButtonStyle" TargetType="Button">
|
|
<Setter Property="Foreground" Value="#374151"/>
|
|
<Setter Property="Background" Value="#FFFFFF"/>
|
|
<Setter Property="BorderBrush" Value="#C9D5E5"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="FontSize" Value="15"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="3">
|
|
<ContentPresenter HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding DataContext.IsPrimary, RelativeSource={RelativeSource TemplatedParent}}" Value="True">
|
|
<Setter Property="Background" Value="#2E5FA7"/>
|
|
<Setter Property="BorderBrush" Value="#2E5FA7"/>
|
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
|
</DataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding DataContext.IsPrimary, RelativeSource={RelativeSource TemplatedParent}}" Value="False"/>
|
|
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="Background" Value="#F5F8FC"/>
|
|
<Setter Property="BorderBrush" Value="#AFC3DD"/>
|
|
</MultiDataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding DataContext.IsPrimary, RelativeSource={RelativeSource TemplatedParent}}" Value="False"/>
|
|
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="Background" Value="#E8EEF6"/>
|
|
<Setter Property="BorderBrush" Value="#9FB7D6"/>
|
|
</MultiDataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding DataContext.IsPrimary, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
|
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="Background" Value="#254F8D"/>
|
|
<Setter Property="BorderBrush" Value="#254F8D"/>
|
|
</MultiDataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding DataContext.IsPrimary, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
|
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="Background" Value="#1E4174"/>
|
|
<Setter Property="BorderBrush" Value="#1E4174"/>
|
|
</MultiDataTrigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="#9CA3AF"/>
|
|
<Setter Property="Background" Value="#F3F4F6"/>
|
|
<Setter Property="BorderBrush" Value="#E5E7EB"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="MwMessageBoxCaptionStyle" TargetType="TextBlock">
|
|
<Setter Property="Text" Value="{Binding State.Caption}"/>
|
|
<Setter Property="Visibility" Value="Visible"/>
|
|
<Style.Triggers>
|
|
<Trigger Property="Text" Value="">
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</Trigger>
|
|
<Trigger Property="Text" Value="{x:Null}">
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style x:Key="MwMessageBoxCloseButtonStyle" TargetType="Button">
|
|
<Setter Property="Width" Value="44"/>
|
|
<Setter Property="Height" Value="32"/>
|
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
|
<Setter Property="Background" Value="#2E5FA7"/>
|
|
<Setter Property="BorderBrush" Value="#2E5FA7"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border Background="{TemplateBinding Background}">
|
|
<ContentPresenter HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#C94A4A"/>
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter Property="Background" Value="#A53B3B"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</Window.Resources>
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="Closing">
|
|
<i:InvokeCommandAction Command="{Binding WindowClosingCommand}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Border Background="#FFFFFF"
|
|
CornerRadius="2"
|
|
BorderBrush="#C6D1DF"
|
|
BorderThickness="1">
|
|
<Border.Effect>
|
|
<DropShadowEffect Color="#1F3A5A"
|
|
BlurRadius="18"
|
|
ShadowDepth="2"
|
|
Opacity="0.18"/>
|
|
</Border.Effect>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="32"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid Grid.Row="0" Background="#2E5FA7">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid Grid.Column="0"
|
|
behaviors:WindowDragMoveBehavior.IsEnabled="True">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border Width="16"
|
|
Height="16"
|
|
Margin="10,0,8,0"
|
|
VerticalAlignment="Center"
|
|
BorderBrush="#D8E6F7"
|
|
BorderThickness="1"
|
|
CornerRadius="8">
|
|
<TextBlock Text="i"
|
|
Foreground="#FFFFFF"
|
|
FontSize="11"
|
|
FontWeight="Bold"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"/>
|
|
</Border>
|
|
|
|
<TextBlock Grid.Column="1"
|
|
VerticalAlignment="Center"
|
|
Foreground="#FFFFFF"
|
|
FontSize="13"
|
|
FontWeight="Normal"
|
|
TextTrimming="CharacterEllipsis">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Text" Value="{Binding State.Caption}"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding State.Caption}" Value="{x:Null}">
|
|
<Setter Property="Text" Value="{DynamicResource Msg_Title_Info}"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding State.Caption}" Value="">
|
|
<Setter Property="Text" Value="{DynamicResource Msg_Title_Info}"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</Grid>
|
|
|
|
<Button Grid.Column="1"
|
|
x:Name="CloseButton"
|
|
Style="{StaticResource MwMessageBoxCloseButtonStyle}"
|
|
Click="OnCloseButtonClick"/>
|
|
</Grid>
|
|
|
|
<Grid Grid.Row="1" Margin="28,28,28,22">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border Width="62"
|
|
Height="62"
|
|
HorizontalAlignment="Center"
|
|
Background="#FFFFFF"
|
|
BorderBrush="{Binding State.AccentBrush}"
|
|
BorderThickness="1.5"
|
|
CornerRadius="31">
|
|
<Viewbox Width="26"
|
|
Height="26"
|
|
Stretch="Uniform">
|
|
<Path Data="{Binding State.IconPathData}"
|
|
Fill="{Binding State.IconForegroundBrush}"
|
|
Stretch="Uniform"/>
|
|
</Viewbox>
|
|
</Border>
|
|
|
|
<TextBlock Grid.Row="1"
|
|
Margin="0,18,0,0"
|
|
HorizontalAlignment="Center"
|
|
Foreground="#1F2937"
|
|
FontSize="17"
|
|
FontWeight="SemiBold"
|
|
TextAlignment="Center"
|
|
Style="{StaticResource MwMessageBoxCaptionStyle}"/>
|
|
|
|
<TextBlock Grid.Row="2"
|
|
Margin="0,14,0,0"
|
|
MaxWidth="540"
|
|
Text="{Binding State.Message}"
|
|
TextWrapping="Wrap"
|
|
Foreground="#4B5563"
|
|
FontSize="14"
|
|
LineHeight="23"
|
|
TextAlignment="Center"
|
|
FlowDirection="{Binding State.MessageFlowDirection}"/>
|
|
</Grid>
|
|
|
|
<Grid Grid.Row="2">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="1"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border Grid.Row="0"
|
|
Background="#E7EEF7"/>
|
|
|
|
<ItemsControl Grid.Row="1"
|
|
Margin="0,18,0,20"
|
|
ItemsSource="{Binding State.Buttons}"
|
|
HorizontalAlignment="Center"
|
|
MaxWidth="560">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Center"/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Button Content="{Binding Text}"
|
|
MinWidth="96"
|
|
Height="38"
|
|
Margin="8,0,8,0"
|
|
Padding="22,0,22,0"
|
|
IsDefault="{Binding IsDefault}"
|
|
IsCancel="{Binding IsCancel}"
|
|
Style="{Binding ButtonStyle, TargetNullValue={StaticResource MwMessageBoxButtonStyle}}"
|
|
Command="{Binding DataContext.SelectButtonCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
|
CommandParameter="{Binding}"/>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</Window> |