MessageControl.xaml 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <UserControl x:Class="Aitex.Core.UI.Control.MessageControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:cvt="clr-namespace:Aitex.Core.UI.Converters"
  5. xmlns:taskbarNotification="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=MECF.Framework.Common"
  6. x:Name="me"
  7. Height="32" Width="1100" Foreground="Black" >
  8. <UserControl.Resources>
  9. <Storyboard x:Key="FadeIn">
  10. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
  11. <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
  12. <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.95"/>
  13. <SplineDoubleKeyFrame KeyTime="00:00:03" Value="0.95"/>
  14. <!-- <SplineDoubleKeyFrame KeyTime="00:00:05" Value="0"/>-->
  15. </DoubleAnimationUsingKeyFrames>
  16. </Storyboard>
  17. <Storyboard x:Key="HighlightCloseButton">
  18. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)">
  19. <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.4"/>
  20. <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
  21. </DoubleAnimationUsingKeyFrames>
  22. </Storyboard>
  23. <Storyboard x:Key="FadeCloseButton">
  24. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="imgClose" Storyboard.TargetProperty="(UIElement.Opacity)">
  25. <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
  26. <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.4"/>
  27. </DoubleAnimationUsingKeyFrames>
  28. </Storyboard>
  29. <Storyboard x:Key="FadeBack">
  30. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
  31. <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
  32. <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
  33. </DoubleAnimationUsingKeyFrames>
  34. </Storyboard>
  35. <Storyboard x:Key="FadeOut" Completed="OnFadeOutCompleted" >
  36. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
  37. <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
  38. <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.2"/>
  39. </DoubleAnimationUsingKeyFrames>
  40. </Storyboard>
  41. </UserControl.Resources>
  42. <UserControl.Triggers>
  43. <EventTrigger RoutedEvent="taskbarNotification:TaskbarIcon.BalloonShowing">
  44. <BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
  45. </EventTrigger>
  46. <EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="imgClose">
  47. <BeginStoryboard Storyboard="{StaticResource HighlightCloseButton}" x:Name="HighlightCloseButton_BeginStoryboard"/>
  48. </EventTrigger>
  49. <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="imgClose">
  50. <BeginStoryboard Storyboard="{StaticResource FadeCloseButton}" x:Name="FadeCloseButton_BeginStoryboard"/>
  51. </EventTrigger>
  52. <EventTrigger RoutedEvent="Mouse.MouseEnter">
  53. <StopStoryboard BeginStoryboardName="FadeIn_BeginStoryboard"/>
  54. <BeginStoryboard x:Name="FadeBack_BeginStoryboard1" Storyboard="{StaticResource FadeBack}"/>
  55. </EventTrigger>
  56. <EventTrigger RoutedEvent="taskbarNotification:TaskbarIcon.BalloonClosing">
  57. <BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>
  58. </EventTrigger>
  59. </UserControl.Triggers>
  60. <Canvas x:Name="grid" Width="Auto" MouseEnter="grid_MouseEnter" MouseMove="grid_MouseEnter" >
  61. <Rectangle Height="30" RadiusY="5" RadiusX="5" Stroke="Black" Canvas.Left="0" Canvas.Top="0" >
  62. <Rectangle.Width>
  63. <Binding Path="ActualWidth" ElementName="MessageLbl">
  64. <Binding.Converter>
  65. <cvt:WidthMoreConvertor></cvt:WidthMoreConvertor>
  66. </Binding.Converter>
  67. </Binding>
  68. </Rectangle.Width>
  69. <Rectangle.Fill>
  70. <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
  71. <GradientStop Color="#bdbdbd" Offset="0"/>
  72. <GradientStop Color="#c8c8c8" Offset="1"/>
  73. </LinearGradientBrush>
  74. </Rectangle.Fill>
  75. </Rectangle>
  76. <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" />
  77. <TextBlock FontSize="16" Canvas.Left="22.8" Width="Auto" Canvas.Top="6.8" x:Name="MessageLbl" Height="Auto"></TextBlock>
  78. <!--Content="{Binding Path=MessageText, ElementName=me, Mode=Default}"-->
  79. </Canvas>
  80. </UserControl>