mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-17 01:35:40 -05:00
ADD Git attributes.
CHG End of line conversion.
This commit is contained in:
@@ -1,162 +1,162 @@
|
||||
<UserControl x:Class="Samples.FancyBalloon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
x:Name="me"
|
||||
Height="120"
|
||||
Width="240">
|
||||
<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="tb: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="tb:TaskbarIcon.BalloonClosing">
|
||||
<BeginStoryboard Storyboard="{StaticResource FadeOut}"
|
||||
x:Name="FadeOut_BeginStoryboard" />
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid x:Name="grid"
|
||||
MouseEnter="grid_MouseEnter">
|
||||
<Border HorizontalAlignment="Stretch"
|
||||
Margin="5,5,5,5"
|
||||
BorderThickness="1,1,1,1"
|
||||
BorderBrush="#FF997137">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#FF747474" />
|
||||
</Border.Effect>
|
||||
<Border.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop Color="#FF4B4B4B"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#FF8F8F8F"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Image HorizontalAlignment="Left"
|
||||
Margin="0,10,0,0"
|
||||
Width="72"
|
||||
Source="/Images/Info.png"
|
||||
Stretch="Fill"
|
||||
Height="72"
|
||||
VerticalAlignment="Top" />
|
||||
<TextBlock Margin="72,49.2,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="#FFECAD25"
|
||||
TextWrapping="Wrap">
|
||||
<Run Text="This is a user control. The animation uses the attached " />
|
||||
<Run FontStyle="Italic"
|
||||
FontWeight="Bold"
|
||||
Text="BalloonShowing " />
|
||||
<Run Text="event." />
|
||||
</TextBlock>
|
||||
<Path Fill="#FFFFFFFF"
|
||||
Stretch="Fill"
|
||||
Margin="72,38.2,34,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="1"
|
||||
Data="M26,107 L220.04123,107"
|
||||
SnapsToDevicePixels="True">
|
||||
<Path.Stroke>
|
||||
<LinearGradientBrush EndPoint="0.973,0.5"
|
||||
StartPoint="0.005,0.5">
|
||||
<GradientStop Color="#00ECAD25"
|
||||
Offset="1" />
|
||||
<GradientStop Color="#87ECAD25"
|
||||
Offset="0" />
|
||||
</LinearGradientBrush>
|
||||
</Path.Stroke>
|
||||
</Path>
|
||||
<TextBlock Margin="72,10,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="23.2"
|
||||
Text="{Binding Path=BalloonText, ElementName=me, Mode=Default}"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#FFECAD25"
|
||||
FontWeight="Bold" />
|
||||
<Image HorizontalAlignment="Right"
|
||||
Margin="0,10,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Close.png"
|
||||
Stretch="Fill"
|
||||
Opacity="0.4"
|
||||
ToolTip="Close Balloon"
|
||||
x:Name="imgClose"
|
||||
MouseDown="imgClose_MouseDown" />
|
||||
|
||||
</Grid>
|
||||
<UserControl x:Class="Samples.FancyBalloon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
x:Name="me"
|
||||
Height="120"
|
||||
Width="240">
|
||||
<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="tb: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="tb:TaskbarIcon.BalloonClosing">
|
||||
<BeginStoryboard Storyboard="{StaticResource FadeOut}"
|
||||
x:Name="FadeOut_BeginStoryboard" />
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid x:Name="grid"
|
||||
MouseEnter="grid_MouseEnter">
|
||||
<Border HorizontalAlignment="Stretch"
|
||||
Margin="5,5,5,5"
|
||||
BorderThickness="1,1,1,1"
|
||||
BorderBrush="#FF997137">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="#FF747474" />
|
||||
</Border.Effect>
|
||||
<Border.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop Color="#FF4B4B4B"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#FF8F8F8F"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Image HorizontalAlignment="Left"
|
||||
Margin="0,10,0,0"
|
||||
Width="72"
|
||||
Source="/Images/Info.png"
|
||||
Stretch="Fill"
|
||||
Height="72"
|
||||
VerticalAlignment="Top" />
|
||||
<TextBlock Margin="72,49.2,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="#FFECAD25"
|
||||
TextWrapping="Wrap">
|
||||
<Run Text="This is a user control. The animation uses the attached " />
|
||||
<Run FontStyle="Italic"
|
||||
FontWeight="Bold"
|
||||
Text="BalloonShowing " />
|
||||
<Run Text="event." />
|
||||
</TextBlock>
|
||||
<Path Fill="#FFFFFFFF"
|
||||
Stretch="Fill"
|
||||
Margin="72,38.2,34,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="1"
|
||||
Data="M26,107 L220.04123,107"
|
||||
SnapsToDevicePixels="True">
|
||||
<Path.Stroke>
|
||||
<LinearGradientBrush EndPoint="0.973,0.5"
|
||||
StartPoint="0.005,0.5">
|
||||
<GradientStop Color="#00ECAD25"
|
||||
Offset="1" />
|
||||
<GradientStop Color="#87ECAD25"
|
||||
Offset="0" />
|
||||
</LinearGradientBrush>
|
||||
</Path.Stroke>
|
||||
</Path>
|
||||
<TextBlock Margin="72,10,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="23.2"
|
||||
Text="{Binding Path=BalloonText, ElementName=me, Mode=Default}"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#FFECAD25"
|
||||
FontWeight="Bold" />
|
||||
<Image HorizontalAlignment="Right"
|
||||
Margin="0,10,10,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Close.png"
|
||||
Stretch="Fill"
|
||||
Opacity="0.4"
|
||||
ToolTip="Close Balloon"
|
||||
x:Name="imgClose"
|
||||
MouseDown="imgClose_MouseDown" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,107 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyBalloon.xaml
|
||||
/// </summary>
|
||||
public partial class FancyBalloon : UserControl
|
||||
{
|
||||
private bool isClosing = false;
|
||||
|
||||
#region BalloonText dependency property
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty BalloonTextProperty =
|
||||
DependencyProperty.Register("BalloonText",
|
||||
typeof (string),
|
||||
typeof (FancyBalloon),
|
||||
new FrameworkPropertyMetadata(""));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="BalloonTextProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public string BalloonText
|
||||
{
|
||||
get { return (string) GetValue(BalloonTextProperty); }
|
||||
set { SetValue(BalloonTextProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FancyBalloon()
|
||||
{
|
||||
InitializeComponent();
|
||||
TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// By subscribing to the <see cref="TaskbarIcon.BalloonClosingEvent"/>
|
||||
/// and setting the "Handled" property to true, we suppress the popup
|
||||
/// from being closed in order to display the custom fade-out animation.
|
||||
/// </summary>
|
||||
private void OnBalloonClosing(object sender, RoutedEventArgs e)
|
||||
{
|
||||
e.Handled = true; //suppresses the popup from being closed immediately
|
||||
isClosing = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the <see cref="TaskbarIcon"/> that displayed
|
||||
/// the balloon and requests a close action.
|
||||
/// </summary>
|
||||
private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//the tray icon assigned this attached property to simplify access
|
||||
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
|
||||
taskbarIcon.CloseBalloon();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the users hovers over the balloon, we don't close it.
|
||||
/// </summary>
|
||||
private void grid_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
//if we're already running the fade-out animation, do not interrupt anymore
|
||||
//(makes things too complicated for the sample)
|
||||
if (isClosing) return;
|
||||
|
||||
//the tray icon assigned this attached property to simplify access
|
||||
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
|
||||
taskbarIcon.ResetBalloonCloseTimer();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Closes the popup once the fade-out animation completed.
|
||||
/// The animation was triggered in XAML through the attached
|
||||
/// BalloonClosing event.
|
||||
/// </summary>
|
||||
private void OnFadeOutCompleted(object sender, EventArgs e)
|
||||
{
|
||||
Popup pp = (Popup) Parent;
|
||||
pp.IsOpen = false;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyBalloon.xaml
|
||||
/// </summary>
|
||||
public partial class FancyBalloon : UserControl
|
||||
{
|
||||
private bool isClosing = false;
|
||||
|
||||
#region BalloonText dependency property
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty BalloonTextProperty =
|
||||
DependencyProperty.Register("BalloonText",
|
||||
typeof (string),
|
||||
typeof (FancyBalloon),
|
||||
new FrameworkPropertyMetadata(""));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="BalloonTextProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public string BalloonText
|
||||
{
|
||||
get { return (string) GetValue(BalloonTextProperty); }
|
||||
set { SetValue(BalloonTextProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FancyBalloon()
|
||||
{
|
||||
InitializeComponent();
|
||||
TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// By subscribing to the <see cref="TaskbarIcon.BalloonClosingEvent"/>
|
||||
/// and setting the "Handled" property to true, we suppress the popup
|
||||
/// from being closed in order to display the custom fade-out animation.
|
||||
/// </summary>
|
||||
private void OnBalloonClosing(object sender, RoutedEventArgs e)
|
||||
{
|
||||
e.Handled = true; //suppresses the popup from being closed immediately
|
||||
isClosing = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the <see cref="TaskbarIcon"/> that displayed
|
||||
/// the balloon and requests a close action.
|
||||
/// </summary>
|
||||
private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//the tray icon assigned this attached property to simplify access
|
||||
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
|
||||
taskbarIcon.CloseBalloon();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the users hovers over the balloon, we don't close it.
|
||||
/// </summary>
|
||||
private void grid_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
//if we're already running the fade-out animation, do not interrupt anymore
|
||||
//(makes things too complicated for the sample)
|
||||
if (isClosing) return;
|
||||
|
||||
//the tray icon assigned this attached property to simplify access
|
||||
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
|
||||
taskbarIcon.ResetBalloonCloseTimer();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Closes the popup once the fade-out animation completed.
|
||||
/// The animation was triggered in XAML through the attached
|
||||
/// BalloonClosing event.
|
||||
/// </summary>
|
||||
private void OnFadeOutCompleted(object sender, EventArgs e)
|
||||
{
|
||||
Popup pp = (Popup) Parent;
|
||||
pp.IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +1,115 @@
|
||||
<UserControl
|
||||
x:Class="Samples.FancyPopup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
Height="215"
|
||||
Width="300" x:Name="me">
|
||||
<UserControl.Resources>
|
||||
<Storyboard x:Key="RotateIcon">
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
|
||||
<SplineDoubleKeyFrame KeySpline="0,0.284,0.39,1" KeyTime="00:00:01.4000000" Value="360"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.PopupOpened">
|
||||
<BeginStoryboard Storyboard="{StaticResource RotateIcon}" x:Name="RotateIcon_BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid>
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Margin="5,5,5,5"
|
||||
CornerRadius="10,10,10,10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
Color="#FF474747" />
|
||||
</Border.Effect>
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FF58C2FF"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Image
|
||||
HorizontalAlignment="Left"
|
||||
Margin="19,10,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="72"
|
||||
Height="72"
|
||||
Source="/Images/Preferences.png"
|
||||
Stretch="Fill" x:Name="image" RenderTransformOrigin="0.5,0.5" >
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<TextBlock
|
||||
Margin="107,10,20,0"
|
||||
TextWrapping="Wrap"
|
||||
Height="Auto"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF575757" HorizontalAlignment="Right"><Run
|
||||
Text="This is a fancy Popup..."
|
||||
Language="de-ch" /></TextBlock>
|
||||
<Button
|
||||
Click="OnButtonClick"
|
||||
ToolTip="{Binding Path=ToolTipText}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="89"
|
||||
Height="29"
|
||||
Content="Click me"
|
||||
Margin="0,0,20,20"
|
||||
BorderBrush="#FFFFFFFF">
|
||||
<Button.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0,1"
|
||||
StartPoint="0,0">
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
<GradientStop
|
||||
Color="#FFFFD197"
|
||||
Offset="0.459" />
|
||||
<GradientStop
|
||||
Color="#FFFFDBAD"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFF18E23"
|
||||
Offset="0.508" />
|
||||
<GradientStop
|
||||
Color="#FFF9D4AC"
|
||||
Offset="0.954" />
|
||||
</LinearGradientBrush>
|
||||
</Button.Background>
|
||||
</Button>
|
||||
<TextBlock
|
||||
Margin="19,92,10,49"
|
||||
TextWrapping="Wrap"><Run Text="This user control makes use of the " Language="de-ch"/><Run FontStyle="Italic" FontWeight="Bold" Text="PopupOpened " Language="de-ch"/><Run Text="attached routed event . Whenever the popup is opened, this attached event fires and triggers the rotation animation." Language="de-ch"/></TextBlock>
|
||||
<TextBlock Margin="0,52,20,0" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" FontWeight="Bold" FontSize="14" HorizontalAlignment="Right" Foreground="#FF575757"><Run Text="Clicks: " Language="de-ch"/><InlineUIContainer>
|
||||
<TextBlock Width="Auto" Height="Auto" Text="{Binding Path=ClickCount, ElementName=me, Mode=Default}" TextWrapping="Wrap"/>
|
||||
</InlineUIContainer></TextBlock>
|
||||
<Image
|
||||
Source="{Binding Path=IconSource}" Width="16" HorizontalAlignment="Left" Margin="19,0,0,23" Height="16" VerticalAlignment="Bottom" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
<UserControl
|
||||
x:Class="Samples.FancyPopup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
Height="215"
|
||||
Width="300" x:Name="me">
|
||||
<UserControl.Resources>
|
||||
<Storyboard x:Key="RotateIcon">
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
|
||||
<SplineDoubleKeyFrame KeySpline="0,0.284,0.39,1" KeyTime="00:00:01.4000000" Value="360"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.PopupOpened">
|
||||
<BeginStoryboard Storyboard="{StaticResource RotateIcon}" x:Name="RotateIcon_BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid>
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Margin="5,5,5,5"
|
||||
CornerRadius="10,10,10,10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
Color="#FF474747" />
|
||||
</Border.Effect>
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FF58C2FF"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Image
|
||||
HorizontalAlignment="Left"
|
||||
Margin="19,10,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="72"
|
||||
Height="72"
|
||||
Source="/Images/Preferences.png"
|
||||
Stretch="Fill" x:Name="image" RenderTransformOrigin="0.5,0.5" >
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<TextBlock
|
||||
Margin="107,10,20,0"
|
||||
TextWrapping="Wrap"
|
||||
Height="Auto"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF575757" HorizontalAlignment="Right"><Run
|
||||
Text="This is a fancy Popup..."
|
||||
Language="de-ch" /></TextBlock>
|
||||
<Button
|
||||
Click="OnButtonClick"
|
||||
ToolTip="{Binding Path=ToolTipText}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="89"
|
||||
Height="29"
|
||||
Content="Click me"
|
||||
Margin="0,0,20,20"
|
||||
BorderBrush="#FFFFFFFF">
|
||||
<Button.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0,1"
|
||||
StartPoint="0,0">
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
<GradientStop
|
||||
Color="#FFFFD197"
|
||||
Offset="0.459" />
|
||||
<GradientStop
|
||||
Color="#FFFFDBAD"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFF18E23"
|
||||
Offset="0.508" />
|
||||
<GradientStop
|
||||
Color="#FFF9D4AC"
|
||||
Offset="0.954" />
|
||||
</LinearGradientBrush>
|
||||
</Button.Background>
|
||||
</Button>
|
||||
<TextBlock
|
||||
Margin="19,92,10,49"
|
||||
TextWrapping="Wrap"><Run Text="This user control makes use of the " Language="de-ch"/><Run FontStyle="Italic" FontWeight="Bold" Text="PopupOpened " Language="de-ch"/><Run Text="attached routed event . Whenever the popup is opened, this attached event fires and triggers the rotation animation." Language="de-ch"/></TextBlock>
|
||||
<TextBlock Margin="0,52,20,0" VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" FontWeight="Bold" FontSize="14" HorizontalAlignment="Right" Foreground="#FF575757"><Run Text="Clicks: " Language="de-ch"/><InlineUIContainer>
|
||||
<TextBlock Width="Auto" Height="Auto" Text="{Binding Path=ClickCount, ElementName=me, Mode=Default}" TextWrapping="Wrap"/>
|
||||
</InlineUIContainer></TextBlock>
|
||||
<Image
|
||||
Source="{Binding Path=IconSource}" Width="16" HorizontalAlignment="Left" Margin="19,0,0,23" Height="16" VerticalAlignment="Bottom" />
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyPopup.xaml
|
||||
/// </summary>
|
||||
public partial class FancyPopup : UserControl
|
||||
{
|
||||
#region ClickCount dependency property
|
||||
|
||||
/// <summary>
|
||||
/// The number of clicks on the popup button.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ClickCountProperty =
|
||||
DependencyProperty.Register("ClickCount",
|
||||
typeof (int),
|
||||
typeof (FancyPopup),
|
||||
new FrameworkPropertyMetadata(0));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="ClickCountProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// The number of clicks on the popup button.
|
||||
/// </summary>
|
||||
public int ClickCount
|
||||
{
|
||||
get { return (int) GetValue(ClickCountProperty); }
|
||||
set { SetValue(ClickCountProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FancyPopup()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//just increment a counter - will be displayed on screen
|
||||
ClickCount++;
|
||||
}
|
||||
}
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyPopup.xaml
|
||||
/// </summary>
|
||||
public partial class FancyPopup : UserControl
|
||||
{
|
||||
#region ClickCount dependency property
|
||||
|
||||
/// <summary>
|
||||
/// The number of clicks on the popup button.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ClickCountProperty =
|
||||
DependencyProperty.Register("ClickCount",
|
||||
typeof (int),
|
||||
typeof (FancyPopup),
|
||||
new FrameworkPropertyMetadata(0));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="ClickCountProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// The number of clicks on the popup button.
|
||||
/// </summary>
|
||||
public int ClickCount
|
||||
{
|
||||
get { return (int) GetValue(ClickCountProperty); }
|
||||
set { SetValue(ClickCountProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FancyPopup()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//just increment a counter - will be displayed on screen
|
||||
ClickCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +1,114 @@
|
||||
<UserControl
|
||||
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:tb="http://www.hardcodet.net/taskbar"
|
||||
mc:Ignorable="d"
|
||||
x:Class="Samples.FancyToolTip"
|
||||
x:Name="me"
|
||||
Width="285"
|
||||
Height="136">
|
||||
<UserControl.Resources>
|
||||
<Storyboard x:Key="FadeIn">
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1" KeySpline="0,0,0.46,0.969"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="FadeOut">
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.25"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.6"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.ToolTipOpened">
|
||||
<BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.ToolTipClose">
|
||||
<BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
|
||||
<Grid
|
||||
x:Name="LayoutRoot" Height="Auto">
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
CornerRadius="6,6,6,6"
|
||||
BorderThickness="3,3,3,3"
|
||||
Margin="0,0,5,5" x:Name="border">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
Color="#FF7A7A7A" />
|
||||
</Border.Effect>
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FFFFD283"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Image
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,10,0,26"
|
||||
Width="72"
|
||||
Source="/Images/Info.png"
|
||||
Stretch="Fill"
|
||||
VerticalAlignment="Top"
|
||||
RenderTransformOrigin="0.792,0.486" x:Name="image" Height="72" >
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<TextBlock
|
||||
Margin="82,10,20,0"
|
||||
TextWrapping="Wrap"
|
||||
Height="32"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF575757"><Run
|
||||
Text="This is a fancy ToolTip..."
|
||||
Language="de-ch" /></TextBlock>
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF141414"
|
||||
TextWrapping="Wrap"
|
||||
Margin="10,0,20,19"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding ElementName=me, Path=InfoText}"
|
||||
x:Name="txtToolTipDetail" d:LayoutOverrides="Height" />
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
FontWeight="Normal"
|
||||
Foreground="#FF141414"
|
||||
TextWrapping="Wrap"
|
||||
Margin="82,42,20,44.96"
|
||||
x:Name="txtToolTipDetail_Copy" ><Run Text="Data binding is simple: The NotifyIcon sets the DataContext unless it's not already in use." Language="de-ch"/></TextBlock>
|
||||
</Grid>
|
||||
<UserControl
|
||||
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:tb="http://www.hardcodet.net/taskbar"
|
||||
mc:Ignorable="d"
|
||||
x:Class="Samples.FancyToolTip"
|
||||
x:Name="me"
|
||||
Width="285"
|
||||
Height="136">
|
||||
<UserControl.Resources>
|
||||
<Storyboard x:Key="FadeIn">
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1" KeySpline="0,0,0.46,0.969"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="FadeOut">
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.25"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.6"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.ToolTipOpened">
|
||||
<BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.ToolTipClose">
|
||||
<BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
|
||||
<Grid
|
||||
x:Name="LayoutRoot" Height="Auto">
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
CornerRadius="6,6,6,6"
|
||||
BorderThickness="3,3,3,3"
|
||||
Margin="0,0,5,5" x:Name="border">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
Color="#FF7A7A7A" />
|
||||
</Border.Effect>
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FFFFD283"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Image
|
||||
HorizontalAlignment="Left"
|
||||
Margin="10,10,0,26"
|
||||
Width="72"
|
||||
Source="/Images/Info.png"
|
||||
Stretch="Fill"
|
||||
VerticalAlignment="Top"
|
||||
RenderTransformOrigin="0.792,0.486" x:Name="image" Height="72" >
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<TextBlock
|
||||
Margin="82,10,20,0"
|
||||
TextWrapping="Wrap"
|
||||
Height="32"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF575757"><Run
|
||||
Text="This is a fancy ToolTip..."
|
||||
Language="de-ch" /></TextBlock>
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF141414"
|
||||
TextWrapping="Wrap"
|
||||
Margin="10,0,20,19"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding ElementName=me, Path=InfoText}"
|
||||
x:Name="txtToolTipDetail" d:LayoutOverrides="Height" />
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
FontWeight="Normal"
|
||||
Foreground="#FF141414"
|
||||
TextWrapping="Wrap"
|
||||
Margin="82,42,20,44.96"
|
||||
x:Name="txtToolTipDetail_Copy" ><Run Text="Data binding is simple: The NotifyIcon sets the DataContext unless it's not already in use." Language="de-ch"/></TextBlock>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,51 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyToolTip.xaml
|
||||
/// </summary>
|
||||
public partial class FancyToolTip
|
||||
{
|
||||
#region InfoText dependency property
|
||||
|
||||
/// <summary>
|
||||
/// The tooltip details.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty InfoTextProperty =
|
||||
DependencyProperty.Register("InfoText",
|
||||
typeof (string),
|
||||
typeof (FancyToolTip),
|
||||
new FrameworkPropertyMetadata(""));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="InfoTextProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// The tooltip details.
|
||||
/// </summary>
|
||||
public string InfoText
|
||||
{
|
||||
get { return (string) GetValue(InfoTextProperty); }
|
||||
set { SetValue(InfoTextProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FancyToolTip()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyToolTip.xaml
|
||||
/// </summary>
|
||||
public partial class FancyToolTip
|
||||
{
|
||||
#region InfoText dependency property
|
||||
|
||||
/// <summary>
|
||||
/// The tooltip details.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty InfoTextProperty =
|
||||
DependencyProperty.Register("InfoText",
|
||||
typeof (string),
|
||||
typeof (FancyToolTip),
|
||||
new FrameworkPropertyMetadata(""));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="InfoTextProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// The tooltip details.
|
||||
/// </summary>
|
||||
public string InfoText
|
||||
{
|
||||
get { return (string) GetValue(InfoTextProperty); }
|
||||
set { SetValue(InfoTextProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FancyToolTip()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +1,81 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Commands="clr-namespace:Samples.Commands"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar">
|
||||
<LinearGradientBrush x:Key="MenuBackground"
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop Color="#FFFFD892"
|
||||
Offset="1" />
|
||||
<GradientStop Color="#FFFFF3DD"
|
||||
Offset="0.259" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<Style TargetType="{x:Type ContextMenu}">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="1,1,1,1" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ContextMenu}">
|
||||
<Grid>
|
||||
<Border Background="{DynamicResource MenuBackground}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ScrollViewer
|
||||
Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}"
|
||||
Uid="ScrollViewer_9"
|
||||
CanContentScroll="True">
|
||||
<ItemsPresenter Margin="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
KeyboardNavigation.DirectionalNavigation="Cycle" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- The taskbar context menu - the first row is a dummy to show off simple data binding -->
|
||||
<!--
|
||||
The "shared" directive is needed if we reopen the sample window a few times - WPF will otherwise
|
||||
reuse the same context menu (which is a resource) again (which will have its DataContext set to the old TaskbarIcon)
|
||||
-->
|
||||
<ContextMenu x:Shared="false"
|
||||
x:Key="tbMenu">
|
||||
<MenuItem IsEnabled="False"
|
||||
Header="{Binding Path=ToolTipText}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16"
|
||||
Height="16"
|
||||
Source="{Binding Path=IconSource}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Show Showcase Window"
|
||||
Command="{Commands:ShowSampleWindowCommand}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Add.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem Header="Hide Showcase Window"
|
||||
Command="{Commands:HideSampleWindowCommand}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Remove.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
|
||||
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Commands="clr-namespace:Samples.Commands"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar">
|
||||
<LinearGradientBrush x:Key="MenuBackground"
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop Color="#FFFFD892"
|
||||
Offset="1" />
|
||||
<GradientStop Color="#FFFFF3DD"
|
||||
Offset="0.259" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
|
||||
<Style TargetType="{x:Type ContextMenu}">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="1,1,1,1" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ContextMenu}">
|
||||
<Grid>
|
||||
<Border Background="{DynamicResource MenuBackground}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ScrollViewer
|
||||
Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}"
|
||||
Uid="ScrollViewer_9"
|
||||
CanContentScroll="True">
|
||||
<ItemsPresenter Margin="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
KeyboardNavigation.DirectionalNavigation="Cycle" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- The taskbar context menu - the first row is a dummy to show off simple data binding -->
|
||||
<!--
|
||||
The "shared" directive is needed if we reopen the sample window a few times - WPF will otherwise
|
||||
reuse the same context menu (which is a resource) again (which will have its DataContext set to the old TaskbarIcon)
|
||||
-->
|
||||
<ContextMenu x:Shared="false"
|
||||
x:Key="tbMenu">
|
||||
<MenuItem IsEnabled="False"
|
||||
Header="{Binding Path=ToolTipText}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16"
|
||||
Height="16"
|
||||
Source="{Binding Path=IconSource}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Show Showcase Window"
|
||||
Command="{Commands:ShowSampleWindowCommand}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Add.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem Header="Hide Showcase Window"
|
||||
Command="{Commands:HideSampleWindowCommand}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Remove.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,92 +1,92 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Navigation;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ShowcaseWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ShowcaseWindow : Window
|
||||
{
|
||||
public ShowcaseWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
Loaded += delegate
|
||||
{
|
||||
//show balloon at startup
|
||||
var balloon = new WelcomeBalloon();
|
||||
tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 12000);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Displays a balloon tip.
|
||||
/// </summary>
|
||||
private void showBalloonTip_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string title = txtBalloonTitle.Text;
|
||||
string message = txtBalloonText.Text;
|
||||
|
||||
if (rbCustomIcon.IsChecked == true)
|
||||
{
|
||||
//just display the icon on the tray
|
||||
var icon = tb.Icon;
|
||||
tb.ShowBalloonTip(title, message, icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
BalloonIcon bi = rbInfo.IsChecked == true ? BalloonIcon.Info : BalloonIcon.Error;
|
||||
tb.ShowBalloonTip(title, message, bi);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideBalloonTip_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tb.HideBalloonTip();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the tooltip.
|
||||
/// </summary>
|
||||
private void removeToolTip_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tb.TrayToolTip = null;
|
||||
}
|
||||
|
||||
|
||||
private void showCustomBalloon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FancyBalloon balloon = new FancyBalloon();
|
||||
balloon.BalloonText = customBalloonTitle.Text;
|
||||
//show and close after 2.5 seconds
|
||||
tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
|
||||
}
|
||||
|
||||
private void hideCustomBalloon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tb.CloseBalloon();
|
||||
}
|
||||
|
||||
|
||||
private void OnNavigationRequest(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(e.Uri.ToString());
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//clean up notifyicon (would otherwise stay open until application finishes)
|
||||
tb.Dispose();
|
||||
base.OnClosing(e);
|
||||
}
|
||||
}
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Navigation;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ShowcaseWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ShowcaseWindow : Window
|
||||
{
|
||||
public ShowcaseWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
Loaded += delegate
|
||||
{
|
||||
//show balloon at startup
|
||||
var balloon = new WelcomeBalloon();
|
||||
tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 12000);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Displays a balloon tip.
|
||||
/// </summary>
|
||||
private void showBalloonTip_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string title = txtBalloonTitle.Text;
|
||||
string message = txtBalloonText.Text;
|
||||
|
||||
if (rbCustomIcon.IsChecked == true)
|
||||
{
|
||||
//just display the icon on the tray
|
||||
var icon = tb.Icon;
|
||||
tb.ShowBalloonTip(title, message, icon);
|
||||
}
|
||||
else
|
||||
{
|
||||
BalloonIcon bi = rbInfo.IsChecked == true ? BalloonIcon.Info : BalloonIcon.Error;
|
||||
tb.ShowBalloonTip(title, message, bi);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideBalloonTip_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tb.HideBalloonTip();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the tooltip.
|
||||
/// </summary>
|
||||
private void removeToolTip_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tb.TrayToolTip = null;
|
||||
}
|
||||
|
||||
|
||||
private void showCustomBalloon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FancyBalloon balloon = new FancyBalloon();
|
||||
balloon.BalloonText = customBalloonTitle.Text;
|
||||
//show and close after 2.5 seconds
|
||||
tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
|
||||
}
|
||||
|
||||
private void hideCustomBalloon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tb.CloseBalloon();
|
||||
}
|
||||
|
||||
|
||||
private void OnNavigationRequest(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(e.Uri.ToString());
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//clean up notifyicon (would otherwise stay open until application finishes)
|
||||
tb.Dispose();
|
||||
base.OnClosing(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +1,105 @@
|
||||
<UserControl
|
||||
x:Class="Samples.WelcomeBalloon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
Height="130"
|
||||
Width="283"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Name="me">
|
||||
<UserControl.Resources>
|
||||
<Storyboard
|
||||
x:Key="FadeInAndOut">
|
||||
<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.895" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:10"
|
||||
Value="0.895" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:11.6000000"
|
||||
Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger
|
||||
RoutedEvent="tb:TaskbarIcon.BalloonShowing">
|
||||
<BeginStoryboard
|
||||
Storyboard="{StaticResource FadeInAndOut}"
|
||||
x:Name="FadeInAndOut_BeginStoryboard" />
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid
|
||||
x:Name="grid">
|
||||
|
||||
<Border
|
||||
x:Name="border"
|
||||
CornerRadius="10,10,10,10"
|
||||
Margin="0,0,5,5">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FFEEEEEE"
|
||||
Offset="1" />
|
||||
<GradientStop
|
||||
Color="#FFFB6B42"
|
||||
Offset="0" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<Border.Effect>
|
||||
<DropShadowEffect />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="10,10,15,0"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Center">
|
||||
<Run
|
||||
Text="WPF NotifyIcon - Sample Application"
|
||||
Language="de-ch" />
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
Margin="10,38.62,10,0"
|
||||
VerticalAlignment="Top"
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Left">
|
||||
<Run
|
||||
Text="You should see this icon in your system tray:" />
|
||||
<Run
|
||||
Text=" " />
|
||||
<InlineUIContainer>
|
||||
<Image
|
||||
Source="{Binding Path=IconSource}"
|
||||
Width="16"
|
||||
Height="16" />
|
||||
</InlineUIContainer>
|
||||
<LineBreak />
|
||||
<Run
|
||||
Text="This is your NotifyIcon." />
|
||||
<LineBreak />
|
||||
<Run
|
||||
Text="" />
|
||||
<LineBreak />
|
||||
<Run
|
||||
FontSize="10"
|
||||
FontStyle="Italic"
|
||||
Text="You can change the displayed icon by selecting another image in the sample window." />
|
||||
</TextBlock>
|
||||
|
||||
</Grid>
|
||||
<UserControl
|
||||
x:Class="Samples.WelcomeBalloon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
Height="130"
|
||||
Width="283"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Name="me">
|
||||
<UserControl.Resources>
|
||||
<Storyboard
|
||||
x:Key="FadeInAndOut">
|
||||
<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.895" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:10"
|
||||
Value="0.895" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:11.6000000"
|
||||
Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Triggers>
|
||||
<EventTrigger
|
||||
RoutedEvent="tb:TaskbarIcon.BalloonShowing">
|
||||
<BeginStoryboard
|
||||
Storyboard="{StaticResource FadeInAndOut}"
|
||||
x:Name="FadeInAndOut_BeginStoryboard" />
|
||||
</EventTrigger>
|
||||
</UserControl.Triggers>
|
||||
<Grid
|
||||
x:Name="grid">
|
||||
|
||||
<Border
|
||||
x:Name="border"
|
||||
CornerRadius="10,10,10,10"
|
||||
Margin="0,0,5,5">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FFEEEEEE"
|
||||
Offset="1" />
|
||||
<GradientStop
|
||||
Color="#FFFB6B42"
|
||||
Offset="0" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<Border.Effect>
|
||||
<DropShadowEffect />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="10,10,15,0"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Center">
|
||||
<Run
|
||||
Text="WPF NotifyIcon - Sample Application"
|
||||
Language="de-ch" />
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
Margin="10,38.62,10,0"
|
||||
VerticalAlignment="Top"
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Left">
|
||||
<Run
|
||||
Text="You should see this icon in your system tray:" />
|
||||
<Run
|
||||
Text=" " />
|
||||
<InlineUIContainer>
|
||||
<Image
|
||||
Source="{Binding Path=IconSource}"
|
||||
Width="16"
|
||||
Height="16" />
|
||||
</InlineUIContainer>
|
||||
<LineBreak />
|
||||
<Run
|
||||
Text="This is your NotifyIcon." />
|
||||
<LineBreak />
|
||||
<Run
|
||||
Text="" />
|
||||
<LineBreak />
|
||||
<Run
|
||||
FontSize="10"
|
||||
FontStyle="Italic"
|
||||
Text="You can change the displayed icon by selecting another image in the sample window." />
|
||||
</TextBlock>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,27 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WelcomeBalloon.xaml
|
||||
/// </summary>
|
||||
public partial class WelcomeBalloon : UserControl
|
||||
{
|
||||
public WelcomeBalloon()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WelcomeBalloon.xaml
|
||||
/// </summary>
|
||||
public partial class WelcomeBalloon : UserControl
|
||||
{
|
||||
public WelcomeBalloon()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user