123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <Window x:Name="MessageBoxWindow"
- x:Class="Aitex.Core.UI.Dialog.WPFMessageBox"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:Aitex.Core.UI.Dialog"
- mc:Ignorable="d"
- MaxWidth="500"
- AllowsTransparency="True"
- Background="Transparent"
- Closing="MessageBoxWindow_Closing"
- Loaded="Window_Loaded"
- MouseDown="Window_MouseDown"
- RenderTransformOrigin="0.5, 0.5"
- ResizeMode="NoResize"
- Topmost="True"
- ShowInTaskbar="False"
- SizeToContent="WidthAndHeight"
- Title="MyMessageBox"
- WindowStartupLocation="CenterScreen"
- WindowStyle="None">
- <Window.RenderTransform>
- <ScaleTransform x:Name="Scale"/>
- </Window.RenderTransform>
- <Window.Resources>
- <!-- Brushes -->
- <LinearGradientBrush x:Key="BackgroundBrush" StartPoint="0,0" EndPoint="0,1">
- <GradientStop Offset="0" Color="#E4E9F0"/>
- <GradientStop Offset="1" Color="#D5DDED"/>
- </LinearGradientBrush>
- <!-- Styles -->
- <Style TargetType="Label">
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="HorizontalContentAlignment" Value="Left"/>
- <Setter Property="FontFamily" Value="Segoe UI"/>
- <Setter Property="FontSize" Value="12pt"/>
- <Setter Property="Foreground" Value="#FF003399"/>
- </Style>
- <Style TargetType="Image">
- <Setter Property="Height" Value="32"/>
- <Setter Property="Width" Value="32"/>
- <Setter Property="Margin" Value="3"/>
- </Style>
- <Style TargetType="Button">
- <Setter Property="Height" Value="23"/>
- <Setter Property="Width" Value="75"/>
- <Setter Property="Margin" Value="3"/>
- </Style>
- <!-- Animation -->
- <Storyboard x:Key="LoadAnimation">
- <DoubleAnimation
- AccelerationRatio="0.4"
- Duration="00:00:00.15"
- From="0.6"
- Storyboard.TargetName="Scale"
- Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
- To="1.1"/>
- <DoubleAnimation
- AccelerationRatio="0.4"
- Duration="00:00:00.15"
- From="0.6"
- Storyboard.TargetName="Scale"
- Storyboard.TargetProperty="(ScaleTransform.ScaleY)"
- To="1.1"/>
- <DoubleAnimation
- AccelerationRatio="0.4"
- Duration="00:00:00.15"
- From="0"
- Storyboard.TargetName="MessageBoxWindow"
- Storyboard.TargetProperty="(Window.Opacity)"
- To="1"/>
- <DoubleAnimation
- BeginTime="00:00:00.15"
- Duration="00:00:00.1"
- From="1.1"
- Storyboard.TargetName="Scale"
- Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
- To="1"/>
- <DoubleAnimation
- BeginTime="00:00:00.15"
- Duration="00:00:00.1"
- From="1.1"
- Storyboard.TargetName="Scale"
- Storyboard.TargetProperty="(ScaleTransform.ScaleY)"
- To="1"/>
- </Storyboard>
- <Storyboard x:Key="UnloadAnimation">
- <DoubleAnimation
- AccelerationRatio="0.4"
- Duration="00:00:00.2"
- From="1"
- Storyboard.TargetName="Scale"
- Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
- To="0.6"/>
- <DoubleAnimation
- AccelerationRatio="0.4"
- Duration="00:00:00.2"
- From="1"
- Storyboard.TargetName="Scale"
- Storyboard.TargetProperty="(ScaleTransform.ScaleY)"
- To="0.6"/>
- <DoubleAnimation
- AccelerationRatio="0.4"
- Duration="00:00:00.2"
- From="1"
- Storyboard.TargetName="MessageBoxWindow"
- Storyboard.TargetProperty="(Window.Opacity)"
- To="0"/>
- </Storyboard>
- </Window.Resources>
- <!-- Border with Margin = 50 to allow the animation to grow beyond the window's original size.
- If this was omitted the window would just get cropped when it reached it's original size and try to grow-->
- <Border
- Margin="50"
- Background="{StaticResource BackgroundBrush}"
- BorderBrush="CornflowerBlue"
- BorderThickness="2"
- Padding="7">
- <DockPanel LastChildFill="True">
- <Expander
- x:Name="DetailsExpander"
- Margin="0,7,0,0"
- DockPanel.Dock="Bottom"
- Header="细节">
- <DockPanel Margin="3" LastChildFill="True">
- <TextBox
- x:Name="DetailsText"
- MaxHeight="275"
- IsReadOnly="True"
- IsReadOnlyCaretVisible="True"
- TextWrapping="Wrap"
- VerticalScrollBarVisibility="Auto"/>
- </DockPanel>
- </Expander>
- <!-- placeholder for the buttons-->
- <StackPanel
- x:Name="ButtonsPanel"
- HorizontalAlignment="Center"
- DockPanel.Dock="Bottom"
- Orientation="Horizontal"/>
- <Image x:Name="ImagePlaceholder" DockPanel.Dock="Left"/>
- <!-- The label contains a text block to enable text wrapping-->
- <Label x:Name="MessageLabel" DockPanel.Dock="Right">
- <TextBlock x:Name="MessageText" TextWrapping="Wrap"/>
- </Label>
- </DockPanel>
- </Border>
- </Window>
|