Sic.Framework/MECF.Framework.UI.Core/Control/MessageControl.xaml

83 lines
5.1 KiB
Plaintext
Raw Normal View History

2023-04-13 11:51:03 +08:00
<UserControl x:Class="Aitex.Core.UI.Control.MessageControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cvt="clr-namespace:Aitex.Core.UI.Converters"
xmlns:taskbarNotification="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=MECF.Framework.Common"
x:Name="me"
Height="32" Width="1100" Foreground="Black" >
<UserControl.Resources>
<Storyboard x:Key="FadeIn">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.95"/>
<SplineDoubleKeyFrame KeyTime="00:00:03" Value="0.95"/>
<!-- <SplineDoubleKeyFrame KeyTime="00:00:05" Value="0"/>-->
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="HighlightCloseButton">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.4"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FadeCloseButton">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.4"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FadeBack">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FadeOut" Completed="OnFadeOutCompleted" >
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.2"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="taskbarNotification:TaskbarIcon.BalloonShowing">
<BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
</EventTrigger>
<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="imgClose">
<BeginStoryboard Storyboard="{StaticResource HighlightCloseButton}" x:Name="HighlightCloseButton_BeginStoryboard"/>
</EventTrigger>
<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="imgClose">
<BeginStoryboard Storyboard="{StaticResource FadeCloseButton}" x:Name="FadeCloseButton_BeginStoryboard"/>
</EventTrigger>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<StopStoryboard BeginStoryboardName="FadeIn_BeginStoryboard"/>
<BeginStoryboard x:Name="FadeBack_BeginStoryboard1" Storyboard="{StaticResource FadeBack}"/>
</EventTrigger>
<EventTrigger RoutedEvent="taskbarNotification:TaskbarIcon.BalloonClosing">
<BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>
</EventTrigger>
</UserControl.Triggers>
<Canvas x:Name="grid" Width="Auto" MouseEnter="grid_MouseEnter" MouseMove="grid_MouseEnter" >
<Rectangle Height="30" RadiusY="5" RadiusX="5" Stroke="Black" Canvas.Left="0" Canvas.Top="0" >
<Rectangle.Width>
<Binding Path="ActualWidth" ElementName="MessageLbl">
<Binding.Converter>
<cvt:WidthMoreConvertor></cvt:WidthMoreConvertor>
</Binding.Converter>
</Binding>
</Rectangle.Width>
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#bdbdbd" Offset="0"/>
<GradientStop Color="#c8c8c8" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Image Canvas.Left="5" Canvas.Top="7" Height="16" Name="imgClose" Opacity="0.4" Source="/MECF.Framework.UI.Core;component/Resources/Exit.png" MouseDown="imgClose_MouseDown" Stretch="Fill" ToolTip="Close Balloon" Width="16" />
<TextBlock FontSize="16" Canvas.Left="22.8" Width="Auto" Canvas.Top="6.8" x:Name="MessageLbl" Height="Auto"></TextBlock>
<!--Content="{Binding Path=MessageText, ElementName=me, Mode=Default}"-->
</Canvas>
</UserControl>