ADD Git attributes.

CHG   End of line conversion.
This commit is contained in:
Philipp Sumi
2013-11-25 17:33:40 +01:00
parent 6b07fab725
commit eac1c5d885
103 changed files with 10426 additions and 10207 deletions

View File

@@ -1,14 +1,14 @@
<Application x:Class="Samples.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Main.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Showcase/NotifyIconResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application x:Class="Samples.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Main.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Showcase/NotifyIconResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -1,24 +1,24 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
{
/// <summary>
/// Closes the current window.
/// </summary>
public class CloseWindowCommand : CommandBase<CloseWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Close();
CommandManager.InvalidateRequerySuggested();
}
public override bool CanExecute(object parameter)
{
Window win = GetTaskbarWindow(parameter);
return win != null;
}
}
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
{
/// <summary>
/// Closes the current window.
/// </summary>
public class CloseWindowCommand : CommandBase<CloseWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Close();
CommandManager.InvalidateRequerySuggested();
}
public override bool CanExecute(object parameter)
{
Window win = GetTaskbarWindow(parameter);
return win != null;
}
}
}

View File

@@ -1,157 +1,157 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples.Commands
{
/// <summary>
/// Basic implementation of the <see cref="ICommand"/>
/// interface, which is also accessible as a markup
/// extension.
/// </summary>
public abstract class CommandBase<T> : MarkupExtension, ICommand
where T : class, ICommand, new()
{
/// <summary>
/// A singleton instance.
/// </summary>
private static T command;
/// <summary>
/// Gets a shared command instance.
/// </summary>
public override object ProvideValue(IServiceProvider serviceProvider)
{
if (command == null) command = new T();
return command;
}
/// <summary>
/// Fires when changes occur that affect whether
/// or not the command should execute.
/// </summary>
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
/// <summary>
/// Defines the method to be called when the command is invoked.
/// </summary>
/// <param name="parameter">Data used by the command.
/// If the command does not require data to be passed,
/// this object can be set to null.
/// </param>
public abstract void Execute(object parameter);
/// <summary>
/// Defines the method that determines whether the command
/// can execute in its current state.
/// </summary>
/// <returns>
/// This default implementation always returns true.
/// </returns>
/// <param name="parameter">Data used by the command.
/// If the command does not require data to be passed,
/// this object can be set to null.
/// </param>
public virtual bool CanExecute(object parameter)
{
return IsDesignMode ? false : true;
}
public static bool IsDesignMode
{
get
{
return (bool)
DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
typeof (FrameworkElement))
.Metadata.DefaultValue;
}
}
/// <summary>
/// Resolves the window that owns the TaskbarIcon class.
/// </summary>
/// <param name="commandParameter"></param>
/// <returns></returns>
protected Window GetTaskbarWindow(object commandParameter)
{
if (IsDesignMode) return null;
//get the showcase window off the taskbaricon
var tb = commandParameter as TaskbarIcon;
return tb == null ? null : TryFindParent<Window>(tb);
}
#region TryFindParent helper
/// <summary>
/// Finds a parent of a given item on the visual tree.
/// </summary>
/// <typeparam name="T">The type of the queried item.</typeparam>
/// <param name="child">A direct or indirect child of the
/// queried item.</param>
/// <returns>The first parent item that matches the submitted
/// type parameter. If not matching item can be found, a null
/// reference is being returned.</returns>
public static T TryFindParent<T>(DependencyObject child)
where T : DependencyObject
{
//get parent item
DependencyObject parentObject = GetParentObject(child);
//we've reached the end of the tree
if (parentObject == null) return null;
//check if the parent matches the type we're looking for
T parent = parentObject as T;
if (parent != null)
{
return parent;
}
else
{
//use recursion to proceed with next level
return TryFindParent<T>(parentObject);
}
}
/// <summary>
/// This method is an alternative to WPF's
/// <see cref="VisualTreeHelper.GetParent"/> method, which also
/// supports content elements. Keep in mind that for content element,
/// this method falls back to the logical tree of the element!
/// </summary>
/// <param name="child">The item to be processed.</param>
/// <returns>The submitted item's parent, if available. Otherwise
/// null.</returns>
public static DependencyObject GetParentObject(DependencyObject child)
{
if (child == null) return null;
ContentElement contentElement = child as ContentElement;
if (contentElement != null)
{
DependencyObject parent = ContentOperations.GetParent(contentElement);
if (parent != null) return parent;
FrameworkContentElement fce = contentElement as FrameworkContentElement;
return fce != null ? fce.Parent : null;
}
//if it's not a ContentElement, rely on VisualTreeHelper
return VisualTreeHelper.GetParent(child);
}
#endregion
}
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples.Commands
{
/// <summary>
/// Basic implementation of the <see cref="ICommand"/>
/// interface, which is also accessible as a markup
/// extension.
/// </summary>
public abstract class CommandBase<T> : MarkupExtension, ICommand
where T : class, ICommand, new()
{
/// <summary>
/// A singleton instance.
/// </summary>
private static T command;
/// <summary>
/// Gets a shared command instance.
/// </summary>
public override object ProvideValue(IServiceProvider serviceProvider)
{
if (command == null) command = new T();
return command;
}
/// <summary>
/// Fires when changes occur that affect whether
/// or not the command should execute.
/// </summary>
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
/// <summary>
/// Defines the method to be called when the command is invoked.
/// </summary>
/// <param name="parameter">Data used by the command.
/// If the command does not require data to be passed,
/// this object can be set to null.
/// </param>
public abstract void Execute(object parameter);
/// <summary>
/// Defines the method that determines whether the command
/// can execute in its current state.
/// </summary>
/// <returns>
/// This default implementation always returns true.
/// </returns>
/// <param name="parameter">Data used by the command.
/// If the command does not require data to be passed,
/// this object can be set to null.
/// </param>
public virtual bool CanExecute(object parameter)
{
return IsDesignMode ? false : true;
}
public static bool IsDesignMode
{
get
{
return (bool)
DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
typeof (FrameworkElement))
.Metadata.DefaultValue;
}
}
/// <summary>
/// Resolves the window that owns the TaskbarIcon class.
/// </summary>
/// <param name="commandParameter"></param>
/// <returns></returns>
protected Window GetTaskbarWindow(object commandParameter)
{
if (IsDesignMode) return null;
//get the showcase window off the taskbaricon
var tb = commandParameter as TaskbarIcon;
return tb == null ? null : TryFindParent<Window>(tb);
}
#region TryFindParent helper
/// <summary>
/// Finds a parent of a given item on the visual tree.
/// </summary>
/// <typeparam name="T">The type of the queried item.</typeparam>
/// <param name="child">A direct or indirect child of the
/// queried item.</param>
/// <returns>The first parent item that matches the submitted
/// type parameter. If not matching item can be found, a null
/// reference is being returned.</returns>
public static T TryFindParent<T>(DependencyObject child)
where T : DependencyObject
{
//get parent item
DependencyObject parentObject = GetParentObject(child);
//we've reached the end of the tree
if (parentObject == null) return null;
//check if the parent matches the type we're looking for
T parent = parentObject as T;
if (parent != null)
{
return parent;
}
else
{
//use recursion to proceed with next level
return TryFindParent<T>(parentObject);
}
}
/// <summary>
/// This method is an alternative to WPF's
/// <see cref="VisualTreeHelper.GetParent"/> method, which also
/// supports content elements. Keep in mind that for content element,
/// this method falls back to the logical tree of the element!
/// </summary>
/// <param name="child">The item to be processed.</param>
/// <returns>The submitted item's parent, if available. Otherwise
/// null.</returns>
public static DependencyObject GetParentObject(DependencyObject child)
{
if (child == null) return null;
ContentElement contentElement = child as ContentElement;
if (contentElement != null)
{
DependencyObject parent = ContentOperations.GetParent(contentElement);
if (parent != null) return parent;
FrameworkContentElement fce = contentElement as FrameworkContentElement;
return fce != null ? fce.Parent : null;
}
//if it's not a ContentElement, rely on VisualTreeHelper
return VisualTreeHelper.GetParent(child);
}
#endregion
}
}

View File

@@ -1,24 +1,24 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
{
/// <summary>
/// Hides the main window.
/// </summary>
public class HideSampleWindowCommand : CommandBase<HideSampleWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Hide();
CommandManager.InvalidateRequerySuggested();
}
public override bool CanExecute(object parameter)
{
Window win = GetTaskbarWindow(parameter);
return win != null && win.IsVisible;
}
}
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
{
/// <summary>
/// Hides the main window.
/// </summary>
public class HideSampleWindowCommand : CommandBase<HideSampleWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Hide();
CommandManager.InvalidateRequerySuggested();
}
public override bool CanExecute(object parameter)
{
Window win = GetTaskbarWindow(parameter);
return win != null && win.IsVisible;
}
}
}

View File

@@ -1,24 +1,24 @@
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
{
/// <summary>
/// Shows the main window.
/// </summary>
public class ShowSampleWindowCommand : CommandBase<ShowSampleWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Show();
CommandManager.InvalidateRequerySuggested();
}
public override bool CanExecute(object parameter)
{
Window win = GetTaskbarWindow(parameter);
return win != null && !win.IsVisible;
}
}
using System.Windows;
using System.Windows.Input;
namespace Samples.Commands
{
/// <summary>
/// Shows the main window.
/// </summary>
public class ShowSampleWindowCommand : CommandBase<ShowSampleWindowCommand>
{
public override void Execute(object parameter)
{
GetTaskbarWindow(parameter).Show();
CommandManager.InvalidateRequerySuggested();
}
public override bool CanExecute(object parameter)
{
Window win = GetTaskbarWindow(parameter);
return win != null && !win.IsVisible;
}
}
}

View File

@@ -1,242 +1,242 @@
<Window
x:Class="Samples.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="NotifyIcon Samples"
Height="626"
Width="703"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" ResizeMode="NoResize">
<Grid
Hyperlink.RequestNavigate="OnNavigationRequest">
<Grid.Background>
<LinearGradientBrush
EndPoint="0.673,0.95"
StartPoint="0.274,0.137">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FFB4C6D8"
Offset="0.982" />
</LinearGradientBrush>
</Grid.Background>
<TextBlock
HorizontalAlignment="Left"
Margin="10,10,0,0"
VerticalAlignment="Top"
FontSize="14"
FontStyle="Italic"
FontWeight="Bold"
TextWrapping="Wrap" Text="WPF NotifyIcon 1.0.5 - Samples"/>
<Button
HorizontalAlignment="Left"
Margin="10,133,0,0"
VerticalAlignment="Top"
Width="164"
Height="27"
Content="NotifyIcon Declaration"
x:Name="btnDeclaration"
Click="btnDeclaration_Click" />
<TextBlock
HorizontalAlignment="Left"
Margin="10,50,0,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run
Text="Tutorials:" />
</TextBlock>
<TextBlock
HorizontalAlignment="Left"
Margin="10,75.96,0,0"
VerticalAlignment="Top"
TextWrapping="Wrap"
Width="224.31"
Height="47.04"
d:LayoutOverrides="HorizontalAlignment">
<Run
Text="Tutorials follow the contents of the CodeProject article. Check the &quot;Tutorials&quot; folder for the source code." />
</TextBlock>
<Button
HorizontalAlignment="Left"
Margin="10,170,0,0"
Width="164"
Content="ToolTips - Inline Declaration"
VerticalAlignment="Top"
Height="27"
x:Name="btnInlineToolTip"
Click="btnInlineToolTip_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,244,0,0"
Width="164"
Content="Popups"
VerticalAlignment="Top"
Height="27"
x:Name="btnPopups"
Click="btnPopups_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,281,0,0"
Width="164"
Content="Context Menus"
VerticalAlignment="Top"
Height="27"
x:Name="btnContextMenus"
Click="btnContextMenus_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,318,0,0"
Width="164"
Content="Balloon Tips"
VerticalAlignment="Top"
Height="27"
x:Name="btnBalloons"
Click="btnBalloons_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,355,0,0"
Width="164"
Content="Commands"
VerticalAlignment="Top"
Height="27"
x:Name="btnCommands"
Click="btnCommands_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,207,0,0"
Width="164"
Content="ToolTip User Control"
Height="27"
VerticalAlignment="Top"
x:Name="btnToolTipControl"
Click="btnToolTipControl_Click" />
<TextBlock
Margin="255.31,50,0,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap"
HorizontalAlignment="Left" Width="110.93">
<Run
Text="Showcase Sample:" />
</TextBlock>
<TextBlock
Margin="255.31,75.96,145.38,0"
VerticalAlignment="Top"
TextWrapping="Wrap"
Height="47.04">
<Run
Text="An interactive sample that shows off most features on a single NotifyIcon." />
</TextBlock>
<Button
Margin="255.31,133,0,0"
VerticalAlignment="Top"
Height="27"
Content="Open Sample Window"
x:Name="btnMainSample"
Click="btnMainSample_Click"
Width="164"
HorizontalAlignment="Left" />
<Path
Fill="#FFFFFFFF"
Stretch="Fill"
Stroke="#FF60758A"
HorizontalAlignment="Left"
Margin="244.31,50,0,66"
Width="1"
Data="M269,57 L269,390.18163" Opacity="0.325" />
<TextBlock
Margin="255.31,191,10,0"
TextWrapping="Wrap"
VerticalAlignment="Top">
<Run Text="The latest news related to the component can be found on the project page:" />
<LineBreak />
<Hyperlink NavigateUri="http://www.hardcodet.net/wpf-notifyicon">
<Run Text="http://www.hardcodet.net/wpf-notifyicon" />
</Hyperlink>
<LineBreak />
<LineBreak />
<Run
Text="Critical feedback is appreciated - please post bug reports, requests, questions etc. to the CodeProject forum" />
<Run Language="de-ch" Text=":" />
<LineBreak />
<Hyperlink NavigateUri="http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx">
<Run Text="http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx" />
</Hyperlink>
<LineBreak />
<LineBreak />
<LineBreak />
<TextBlock>
<Run Text="Love it or hate it? Please let me know and " />
<Hyperlink NavigateUri="http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx">
<Run FontWeight="Bold" Text="rate the project" />
</Hyperlink>
<Run Text=" - thanks!" />
</TextBlock>
</TextBlock>
<TextBlock
Margin="10,0,10,10"
VerticalAlignment="Bottom"
Height="22.42"
TextWrapping="Wrap"
FontWeight="Bold">
<Run
Text="WPF NotifyIcon is free software, released under the" />
<Run
Text=" " />
<Hyperlink
NavigateUri="http://www.codeproject.com/info/cpol10.aspx">
<Run
Text="CodeProject Open License" />
</Hyperlink>
</TextBlock>
<Path
Fill="#FFFFFFFF"
Stretch="Fill"
Stroke="#FF60758A"
Margin="11,0,17.926,41"
VerticalAlignment="Bottom"
Height="1"
Data="M11,517 L561.07363,517" Opacity="0.33" />
<Button
Margin="10,466,0,0"
Content="Events"
VerticalAlignment="Top"
Height="27"
x:Name="btnEvents"
Click="btnEvents_Click" Width="164" HorizontalAlignment="Left" />
<Button
HorizontalAlignment="Left"
Margin="10,392,0,0"
Width="164"
Content="Data Binding"
VerticalAlignment="Top"
Height="27"
x:Name="btnDataBinding"
Click="btnDataBinding_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,429,0,0"
Width="164"
Content="MVVM"
VerticalAlignment="Top"
Height="27"
x:Name="btnMvvm"
Click="btnMvvm_Click" />
<Image Margin="562.24,-19,-41.24,440" Source="Images/Logo.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Opacity="0.235">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-34.915"/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</Grid>
<Window
x:Class="Samples.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="NotifyIcon Samples"
Height="626"
Width="703"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" ResizeMode="NoResize">
<Grid
Hyperlink.RequestNavigate="OnNavigationRequest">
<Grid.Background>
<LinearGradientBrush
EndPoint="0.673,0.95"
StartPoint="0.274,0.137">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FFB4C6D8"
Offset="0.982" />
</LinearGradientBrush>
</Grid.Background>
<TextBlock
HorizontalAlignment="Left"
Margin="10,10,0,0"
VerticalAlignment="Top"
FontSize="14"
FontStyle="Italic"
FontWeight="Bold"
TextWrapping="Wrap" Text="WPF NotifyIcon 1.0.5 - Samples"/>
<Button
HorizontalAlignment="Left"
Margin="10,133,0,0"
VerticalAlignment="Top"
Width="164"
Height="27"
Content="NotifyIcon Declaration"
x:Name="btnDeclaration"
Click="btnDeclaration_Click" />
<TextBlock
HorizontalAlignment="Left"
Margin="10,50,0,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run
Text="Tutorials:" />
</TextBlock>
<TextBlock
HorizontalAlignment="Left"
Margin="10,75.96,0,0"
VerticalAlignment="Top"
TextWrapping="Wrap"
Width="224.31"
Height="47.04"
d:LayoutOverrides="HorizontalAlignment">
<Run
Text="Tutorials follow the contents of the CodeProject article. Check the &quot;Tutorials&quot; folder for the source code." />
</TextBlock>
<Button
HorizontalAlignment="Left"
Margin="10,170,0,0"
Width="164"
Content="ToolTips - Inline Declaration"
VerticalAlignment="Top"
Height="27"
x:Name="btnInlineToolTip"
Click="btnInlineToolTip_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,244,0,0"
Width="164"
Content="Popups"
VerticalAlignment="Top"
Height="27"
x:Name="btnPopups"
Click="btnPopups_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,281,0,0"
Width="164"
Content="Context Menus"
VerticalAlignment="Top"
Height="27"
x:Name="btnContextMenus"
Click="btnContextMenus_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,318,0,0"
Width="164"
Content="Balloon Tips"
VerticalAlignment="Top"
Height="27"
x:Name="btnBalloons"
Click="btnBalloons_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,355,0,0"
Width="164"
Content="Commands"
VerticalAlignment="Top"
Height="27"
x:Name="btnCommands"
Click="btnCommands_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,207,0,0"
Width="164"
Content="ToolTip User Control"
Height="27"
VerticalAlignment="Top"
x:Name="btnToolTipControl"
Click="btnToolTipControl_Click" />
<TextBlock
Margin="255.31,50,0,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap"
HorizontalAlignment="Left" Width="110.93">
<Run
Text="Showcase Sample:" />
</TextBlock>
<TextBlock
Margin="255.31,75.96,145.38,0"
VerticalAlignment="Top"
TextWrapping="Wrap"
Height="47.04">
<Run
Text="An interactive sample that shows off most features on a single NotifyIcon." />
</TextBlock>
<Button
Margin="255.31,133,0,0"
VerticalAlignment="Top"
Height="27"
Content="Open Sample Window"
x:Name="btnMainSample"
Click="btnMainSample_Click"
Width="164"
HorizontalAlignment="Left" />
<Path
Fill="#FFFFFFFF"
Stretch="Fill"
Stroke="#FF60758A"
HorizontalAlignment="Left"
Margin="244.31,50,0,66"
Width="1"
Data="M269,57 L269,390.18163" Opacity="0.325" />
<TextBlock
Margin="255.31,191,10,0"
TextWrapping="Wrap"
VerticalAlignment="Top">
<Run Text="The latest news related to the component can be found on the project page:" />
<LineBreak />
<Hyperlink NavigateUri="http://www.hardcodet.net/wpf-notifyicon">
<Run Text="http://www.hardcodet.net/wpf-notifyicon" />
</Hyperlink>
<LineBreak />
<LineBreak />
<Run
Text="Critical feedback is appreciated - please post bug reports, requests, questions etc. to the CodeProject forum" />
<Run Language="de-ch" Text=":" />
<LineBreak />
<Hyperlink NavigateUri="http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx">
<Run Text="http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx" />
</Hyperlink>
<LineBreak />
<LineBreak />
<LineBreak />
<TextBlock>
<Run Text="Love it or hate it? Please let me know and " />
<Hyperlink NavigateUri="http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx">
<Run FontWeight="Bold" Text="rate the project" />
</Hyperlink>
<Run Text=" - thanks!" />
</TextBlock>
</TextBlock>
<TextBlock
Margin="10,0,10,10"
VerticalAlignment="Bottom"
Height="22.42"
TextWrapping="Wrap"
FontWeight="Bold">
<Run
Text="WPF NotifyIcon is free software, released under the" />
<Run
Text=" " />
<Hyperlink
NavigateUri="http://www.codeproject.com/info/cpol10.aspx">
<Run
Text="CodeProject Open License" />
</Hyperlink>
</TextBlock>
<Path
Fill="#FFFFFFFF"
Stretch="Fill"
Stroke="#FF60758A"
Margin="11,0,17.926,41"
VerticalAlignment="Bottom"
Height="1"
Data="M11,517 L561.07363,517" Opacity="0.33" />
<Button
Margin="10,466,0,0"
Content="Events"
VerticalAlignment="Top"
Height="27"
x:Name="btnEvents"
Click="btnEvents_Click" Width="164" HorizontalAlignment="Left" />
<Button
HorizontalAlignment="Left"
Margin="10,392,0,0"
Width="164"
Content="Data Binding"
VerticalAlignment="Top"
Height="27"
x:Name="btnDataBinding"
Click="btnDataBinding_Click" />
<Button
HorizontalAlignment="Left"
Margin="10,429,0,0"
Width="164"
Content="MVVM"
VerticalAlignment="Top"
Height="27"
x:Name="btnMvvm"
Click="btnMvvm_Click" />
<Image Margin="562.24,-19,-41.24,440" Source="Images/Logo.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Opacity="0.235">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-34.915"/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</Grid>
</Window>

View File

@@ -1,106 +1,106 @@
using System.Diagnostics;
using System.Windows;
using Samples.Tutorials;
using Samples.Tutorials.Balloons;
using Samples.Tutorials.Commands;
using Samples.Tutorials.ContextMenus;
using Samples.Tutorials.DataBinding;
using Samples.Tutorials.Events;
using Samples.Tutorials.MvvmSample;
using Samples.Tutorials.Popups;
using Samples.Tutorials.ToolTips;
namespace Samples
{
/// <summary>
/// Interaction logic for Main.xaml
/// </summary>
public partial class Main : Window
{
public Main()
{
InitializeComponent();
}
/// <summary>
/// Sets <see cref="Window.WindowStartupLocation"/> and
/// <see cref="Window.Owner"/> properties of a dialog that
/// is about to be displayed.
/// </summary>
/// <param name="window">The processed window.</param>
private void ShowDialog(Window window)
{
window.Owner = this;
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ShowDialog();
}
private void btnDeclaration_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new SimpleWindowWithNotifyIcon());
}
private void btnInlineToolTip_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlineToolTipWindow());
}
private void btnToolTipControl_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new UserControlToolTipWindow());
}
private void btnPopups_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlinePopupWindow());
}
private void btnContextMenus_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlineContextMenuWindow());
}
private void btnBalloons_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new BalloonSampleWindow());
}
private void btnCommands_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new CommandWindow());
}
private void btnEvents_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new EventVisualizerWindow());
}
private void btnDataBinding_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new DataBoundToolTipWindow());
}
private void btnMvvm_Click(object sender, System.Windows.RoutedEventArgs e)
{
ShowDialog(new MvvmSampleWindow());
}
private void btnMainSample_Click(object sender, RoutedEventArgs e)
{
var sampleWindow = new ShowcaseWindow();
sampleWindow.Owner = this;
sampleWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
sampleWindow.ShowDialog();
}
private void OnNavigationRequest(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(e.Uri.ToString());
e.Handled = true;
}
}
using System.Diagnostics;
using System.Windows;
using Samples.Tutorials;
using Samples.Tutorials.Balloons;
using Samples.Tutorials.Commands;
using Samples.Tutorials.ContextMenus;
using Samples.Tutorials.DataBinding;
using Samples.Tutorials.Events;
using Samples.Tutorials.MvvmSample;
using Samples.Tutorials.Popups;
using Samples.Tutorials.ToolTips;
namespace Samples
{
/// <summary>
/// Interaction logic for Main.xaml
/// </summary>
public partial class Main : Window
{
public Main()
{
InitializeComponent();
}
/// <summary>
/// Sets <see cref="Window.WindowStartupLocation"/> and
/// <see cref="Window.Owner"/> properties of a dialog that
/// is about to be displayed.
/// </summary>
/// <param name="window">The processed window.</param>
private void ShowDialog(Window window)
{
window.Owner = this;
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ShowDialog();
}
private void btnDeclaration_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new SimpleWindowWithNotifyIcon());
}
private void btnInlineToolTip_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlineToolTipWindow());
}
private void btnToolTipControl_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new UserControlToolTipWindow());
}
private void btnPopups_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlinePopupWindow());
}
private void btnContextMenus_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new InlineContextMenuWindow());
}
private void btnBalloons_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new BalloonSampleWindow());
}
private void btnCommands_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new CommandWindow());
}
private void btnEvents_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new EventVisualizerWindow());
}
private void btnDataBinding_Click(object sender, RoutedEventArgs e)
{
ShowDialog(new DataBoundToolTipWindow());
}
private void btnMvvm_Click(object sender, System.Windows.RoutedEventArgs e)
{
ShowDialog(new MvvmSampleWindow());
}
private void btnMainSample_Click(object sender, RoutedEventArgs e)
{
var sampleWindow = new ShowcaseWindow();
sampleWindow.Owner = this;
sampleWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
sampleWindow.ShowDialog();
}
private void OnNavigationRequest(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(e.Uri.ToString());
e.Handled = true;
}
}
}

View File

@@ -1,58 +1,58 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sample Project")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Sample Project")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sample Project")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Sample Project")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,93 +1,93 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Samples.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Samples.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon Bulb {
get {
object obj = ResourceManager.GetObject("Bulb", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon Computers {
get {
object obj = ResourceManager.GetObject("Computers", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon NetDrives {
get {
object obj = ResourceManager.GetObject("NetDrives", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Samples.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Samples.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon Bulb {
get {
object obj = ResourceManager.GetObject("Bulb", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon Computers {
get {
object obj = ResourceManager.GetObject("Computers", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon NetDrives {
get {
object obj = ResourceManager.GetObject("NetDrives", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@@ -1,130 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Bulb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\bulb.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Computers" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\computers.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NetDrives" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\netdrives.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Bulb" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\bulb.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Computers" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\computers.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NetDrives" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icons\netdrives.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -1,26 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Samples.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Samples.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -1,8 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -1,355 +1,355 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Samples</RootNamespace>
<AssemblyName>Sample Project</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<ExpressionBlendVersion>12.0.41002.1</ExpressionBlendVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tutorials\09 - MVVM\ClockPopup.xaml.cs">
<DependentUpon>ClockPopup.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\09 - MVVM\MvvmSampleViewModel.cs" />
<Compile Include="Tutorials\09 - MVVM\MvvmSampleWindow.xaml.cs">
<DependentUpon>MvvmSampleWindow.xaml</DependentUpon>
</Compile>
<Page Include="Tutorials\09 - MVVM\ClockPopup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\09 - MVVM\MvvmSampleWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Reference Include="PresentationFramework.Aero" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Resource Include="Icons\Inactive.ico" />
<Resource Include="Icons\Error.ico" />
<Resource Include="Images\Info.png" />
<Resource Include="Images\Preferences.png" />
<Page Include="Showcase\FancyToolTip.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\NotifyIconResources.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="Commands\CloseWindowCommand.cs" />
<Compile Include="Showcase\FancyToolTip.xaml.cs">
<DependentUpon>FancyToolTip.xaml</DependentUpon>
</Compile>
<Resource Include="Images\Logo.png" />
<Resource Include="Tutorials\09 - MVVM\Clock.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Showcase\FancyBalloon.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\FancyPopup.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Main.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\02 - ToolTips\UserControlToolTipWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\01 - Declaration\NotifyIconResourceDictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\01 - Declaration\SimpleWindowWithNotifyIcon.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\02 - ToolTips\SimpleUserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\02 - ToolTips\InlineToolTipWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\03 - Popups\InlinePopupWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\04 - ContextMenus\InlineContextMenuWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\06 - Commands\CommandWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\07 - Events\EventVisualizerWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\05 - Balloons\BalloonSampleWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\08 - DataBinding\DataBoundToolTipWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\WelcomeBalloon.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\ShowcaseWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Showcase\ShowcaseWindow.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>ShowcaseWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\CommandBase.cs" />
<Compile Include="Commands\HideSampleWindowCommand.cs" />
<Compile Include="Commands\ShowSampleWindowCommand.cs" />
<Compile Include="Showcase\FancyBalloon.xaml.cs">
<DependentUpon>FancyBalloon.xaml</DependentUpon>
</Compile>
<Compile Include="Showcase\FancyPopup.xaml.cs">
<DependentUpon>FancyPopup.xaml</DependentUpon>
</Compile>
<Compile Include="Main.xaml.cs">
<DependentUpon>Main.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Tutorials\01 - Declaration\SimpleWindowWithNotifyIcon.xaml.cs">
<DependentUpon>SimpleWindowWithNotifyIcon.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\02 - ToolTips\SimpleUserControl.xaml.cs">
<DependentUpon>SimpleUserControl.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\02 - ToolTips\InlineToolTipWindow.xaml.cs">
<DependentUpon>InlineToolTipWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\02 - ToolTips\UserControlToolTipWindow.xaml.cs">
<DependentUpon>UserControlToolTipWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\03 - Popups\InlinePopupWindow.xaml.cs">
<DependentUpon>InlinePopupWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\04 - ContextMenus\InlineContextMenuWindow.xaml.cs">
<DependentUpon>InlineContextMenuWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\06 - Commands\CommandWindow.xaml.cs">
<DependentUpon>CommandWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\06 - Commands\ShowMessageCommand.cs" />
<Compile Include="Tutorials\07 - Events\EventVisualizerWindow.xaml.cs">
<DependentUpon>EventVisualizerWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\05 - Balloons\BalloonSampleWindow.xaml.cs">
<DependentUpon>BalloonSampleWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\08 - DataBinding\DataBoundToolTipWindow.xaml.cs">
<DependentUpon>DataBoundToolTipWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Showcase\WelcomeBalloon.xaml.cs">
<DependentUpon>WelcomeBalloon.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\NetDrives.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\Bulb.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\Computers.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Add.png" />
<Resource Include="Images\Remove.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Close.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj">
<Project>{7AC63864-7638-41C4-969C-D3197EF2BED9}</Project>
<Name>NotifyIconWpf</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{71C74F29-F1C2-49C5-969F-C25AC4CDFCCC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Samples</RootNamespace>
<AssemblyName>Sample Project</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<ExpressionBlendVersion>12.0.41002.1</ExpressionBlendVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tutorials\09 - MVVM\ClockPopup.xaml.cs">
<DependentUpon>ClockPopup.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\09 - MVVM\MvvmSampleViewModel.cs" />
<Compile Include="Tutorials\09 - MVVM\MvvmSampleWindow.xaml.cs">
<DependentUpon>MvvmSampleWindow.xaml</DependentUpon>
</Compile>
<Page Include="Tutorials\09 - MVVM\ClockPopup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\09 - MVVM\MvvmSampleWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Reference Include="PresentationFramework.Aero" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Resource Include="Icons\Inactive.ico" />
<Resource Include="Icons\Error.ico" />
<Resource Include="Images\Info.png" />
<Resource Include="Images\Preferences.png" />
<Page Include="Showcase\FancyToolTip.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\NotifyIconResources.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="Commands\CloseWindowCommand.cs" />
<Compile Include="Showcase\FancyToolTip.xaml.cs">
<DependentUpon>FancyToolTip.xaml</DependentUpon>
</Compile>
<Resource Include="Images\Logo.png" />
<Resource Include="Tutorials\09 - MVVM\Clock.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Showcase\FancyBalloon.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\FancyPopup.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Main.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\02 - ToolTips\UserControlToolTipWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\01 - Declaration\NotifyIconResourceDictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\01 - Declaration\SimpleWindowWithNotifyIcon.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\02 - ToolTips\SimpleUserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\02 - ToolTips\InlineToolTipWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\03 - Popups\InlinePopupWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\04 - ContextMenus\InlineContextMenuWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\06 - Commands\CommandWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\07 - Events\EventVisualizerWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\05 - Balloons\BalloonSampleWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tutorials\08 - DataBinding\DataBoundToolTipWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\WelcomeBalloon.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Showcase\ShowcaseWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Showcase\ShowcaseWindow.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>ShowcaseWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\CommandBase.cs" />
<Compile Include="Commands\HideSampleWindowCommand.cs" />
<Compile Include="Commands\ShowSampleWindowCommand.cs" />
<Compile Include="Showcase\FancyBalloon.xaml.cs">
<DependentUpon>FancyBalloon.xaml</DependentUpon>
</Compile>
<Compile Include="Showcase\FancyPopup.xaml.cs">
<DependentUpon>FancyPopup.xaml</DependentUpon>
</Compile>
<Compile Include="Main.xaml.cs">
<DependentUpon>Main.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Tutorials\01 - Declaration\SimpleWindowWithNotifyIcon.xaml.cs">
<DependentUpon>SimpleWindowWithNotifyIcon.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\02 - ToolTips\SimpleUserControl.xaml.cs">
<DependentUpon>SimpleUserControl.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\02 - ToolTips\InlineToolTipWindow.xaml.cs">
<DependentUpon>InlineToolTipWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\02 - ToolTips\UserControlToolTipWindow.xaml.cs">
<DependentUpon>UserControlToolTipWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\03 - Popups\InlinePopupWindow.xaml.cs">
<DependentUpon>InlinePopupWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\04 - ContextMenus\InlineContextMenuWindow.xaml.cs">
<DependentUpon>InlineContextMenuWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\06 - Commands\CommandWindow.xaml.cs">
<DependentUpon>CommandWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\06 - Commands\ShowMessageCommand.cs" />
<Compile Include="Tutorials\07 - Events\EventVisualizerWindow.xaml.cs">
<DependentUpon>EventVisualizerWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\05 - Balloons\BalloonSampleWindow.xaml.cs">
<DependentUpon>BalloonSampleWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Tutorials\08 - DataBinding\DataBoundToolTipWindow.xaml.cs">
<DependentUpon>DataBoundToolTipWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Showcase\WelcomeBalloon.xaml.cs">
<DependentUpon>WelcomeBalloon.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\NetDrives.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\Bulb.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\Computers.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Add.png" />
<Resource Include="Images\Remove.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Close.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NotifyIconWpf\NotifyIconWpf.csproj">
<Project>{7AC63864-7638-41C4-969C-D3197EF2BED9}</Project>
<Name>NotifyIconWpf</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -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>

View File

@@ -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;
}
}
}

View File

@@ -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>

View File

@@ -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++;
}
}
}

View File

@@ -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>

View File

@@ -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();
}
}
}

View File

@@ -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>

View File

@@ -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);
}
}
}

View File

@@ -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>

View File

@@ -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();
}
}
}

View File

@@ -1,10 +1,10 @@
<ResourceDictionary 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">
<!-- Globally declared notify icon (ResourceDictionary is not in use, example only) -->
<tb:TaskbarIcon x:Key="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world" />
<ResourceDictionary 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">
<!-- Globally declared notify icon (ResourceDictionary is not in use, example only) -->
<tb:TaskbarIcon x:Key="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world" />
</ResourceDictionary>

View File

@@ -1,20 +1,20 @@
<Window
x:Class="Samples.Tutorials.SimpleWindowWithNotifyIcon"
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="300"
Width="300">
<Grid>
<!-- in order to declare a NotifyIcon, all you need is the namespace declaration (see above on line 5) and a single line -->
<tb:TaskbarIcon x:Name="MyNotifyIcon" IconSource="/Icons/Error.ico" ToolTipText="hello world" />
<TextBlock Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap"
Text="You should see an icon in the tray." />
</Grid>
<Window
x:Class="Samples.Tutorials.SimpleWindowWithNotifyIcon"
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="300"
Width="300">
<Grid>
<!-- in order to declare a NotifyIcon, all you need is the namespace declaration (see above on line 5) and a single line -->
<tb:TaskbarIcon x:Name="MyNotifyIcon" IconSource="/Icons/Error.ico" ToolTipText="hello world" />
<TextBlock Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap"
Text="You should see an icon in the tray." />
</Grid>
</Window>

View File

@@ -1,23 +1,23 @@
using System.Windows;
namespace Samples.Tutorials
{
/// <summary>
/// Interaction logic for SimpleWindowWithNotifyIcon.xaml
/// </summary>
public partial class SimpleWindowWithNotifyIcon : Window
{
public SimpleWindowWithNotifyIcon()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
using System.Windows;
namespace Samples.Tutorials
{
/// <summary>
/// Interaction logic for SimpleWindowWithNotifyIcon.xaml
/// </summary>
public partial class SimpleWindowWithNotifyIcon : Window
{
public SimpleWindowWithNotifyIcon()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,41 +1,41 @@
<Window
x:Class="Samples.Tutorials.ToolTips.InlineToolTipWindow"
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="300"
Width="300">
<Grid>
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world">
<!--
We can use arbitrary UI elements as ToolTips.
Let's use a semi-transparent border.
-->
<tb:TaskbarIcon.TrayToolTip>
<Border
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<TextBlock
Text="hello world"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0" VerticalAlignment="Top" FontWeight="Bold" TextWrapping="Wrap">
<Run Text="Move mouse over NotifyIcon to show ToolTip" Language="de-ch" />
</TextBlock>
</Grid>
<Window
x:Class="Samples.Tutorials.ToolTips.InlineToolTipWindow"
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="300"
Width="300">
<Grid>
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world">
<!--
We can use arbitrary UI elements as ToolTips.
Let's use a semi-transparent border.
-->
<tb:TaskbarIcon.TrayToolTip>
<Border
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<TextBlock
Text="hello world"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0" VerticalAlignment="Top" FontWeight="Bold" TextWrapping="Wrap">
<Run Text="Move mouse over NotifyIcon to show ToolTip" Language="de-ch" />
</TextBlock>
</Grid>
</Window>

View File

@@ -1,34 +1,34 @@
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.Shapes;
namespace Samples.Tutorials.ToolTips
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class InlineToolTipWindow : Window
{
public InlineToolTipWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
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.Shapes;
namespace Samples.Tutorials.ToolTips
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class InlineToolTipWindow : Window
{
public InlineToolTipWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,21 +1,21 @@
<UserControl
x:Class="Samples.Tutorials.ToolTips.SimpleUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- a simple user control which displays a fixed text within a border -->
<Border
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<TextBlock
Text="hello world"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<UserControl
x:Class="Samples.Tutorials.ToolTips.SimpleUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- a simple user control which displays a fixed text within a border -->
<Border
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<TextBlock
Text="hello world"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</UserControl>

View File

@@ -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.Tutorials.ToolTips
{
/// <summary>
/// Interaction logic for SimpleUserControl.xaml
/// </summary>
public partial class SimpleUserControl : UserControl
{
public SimpleUserControl()
{
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.Tutorials.ToolTips
{
/// <summary>
/// Interaction logic for SimpleUserControl.xaml
/// </summary>
public partial class SimpleUserControl : UserControl
{
public SimpleUserControl()
{
InitializeComponent();
}
}
}

View File

@@ -1,27 +1,27 @@
<Window
x:Class="Samples.Tutorials.ToolTips.UserControlToolTipWindow"
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"
xmlns:local="clr-namespace:Samples.Tutorials.ToolTips"
Height="300"
Width="300">
<Grid>
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world">
<!-- assign user control as ToolTip -->
<tb:TaskbarIcon.TrayToolTip>
<local:SimpleUserControl />
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0" VerticalAlignment="Top" FontWeight="Bold" TextWrapping="Wrap">
<Run Text="Move mouse over NotifyIcon to show ToolTip" Language="de-ch" />
</TextBlock>
</Grid>
<Window
x:Class="Samples.Tutorials.ToolTips.UserControlToolTipWindow"
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"
xmlns:local="clr-namespace:Samples.Tutorials.ToolTips"
Height="300"
Width="300">
<Grid>
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world">
<!-- assign user control as ToolTip -->
<tb:TaskbarIcon.TrayToolTip>
<local:SimpleUserControl />
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0" VerticalAlignment="Top" FontWeight="Bold" TextWrapping="Wrap">
<Run Text="Move mouse over NotifyIcon to show ToolTip" Language="de-ch" />
</TextBlock>
</Grid>
</Window>

View File

@@ -1,34 +1,34 @@
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.Shapes;
namespace Samples.Tutorials.ToolTips
{
/// <summary>
/// Interaction logic for UserControlToolTipWindow.xaml
/// </summary>
public partial class UserControlToolTipWindow : Window
{
public UserControlToolTipWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
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.Shapes;
namespace Samples.Tutorials.ToolTips
{
/// <summary>
/// Interaction logic for UserControlToolTipWindow.xaml
/// </summary>
public partial class UserControlToolTipWindow : Window
{
public UserControlToolTipWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,61 +1,61 @@
<Window
x:Class="Samples.Tutorials.Popups.InlinePopupWindow"
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"
xmlns:commands="clr-namespace:Samples.Commands"
Height="300"
Width="300">
<Grid>
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world">
<!--
We can use arbitrary UI elements as Popups.
Popups stay open if the user moves away from the tray area
-->
<tb:TaskbarIcon.TrayPopup>
<Border
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Width="160">
<StackPanel>
<TextBox
x:Name="popupText"
Margin="5,10,5,10"
Width="200"
Height="24"
Text="Enter Text..." />
<Button
Content="Click Me!"
Command="{commands:CloseWindowCommand}"
CommandParameter="{Binding}"
Margin="5,0,5,10"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</StackPanel>
</Border>
</tb:TaskbarIcon.TrayPopup>
</tb:TaskbarIcon>
<TextBlock
Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
Text="Left-Click NotifyIcon to open popup." />
<TextBlock
Text="Text on Popup: "
Margin="26,66,24,0"
VerticalAlignment="Top">
<TextBlock Foreground="Red"
Text="{Binding ElementName=popupText, Path=Text}" />
</TextBlock>
</Grid>
<Window
x:Class="Samples.Tutorials.Popups.InlinePopupWindow"
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"
xmlns:commands="clr-namespace:Samples.Commands"
Height="300"
Width="300">
<Grid>
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world">
<!--
We can use arbitrary UI elements as Popups.
Popups stay open if the user moves away from the tray area
-->
<tb:TaskbarIcon.TrayPopup>
<Border
Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Width="160">
<StackPanel>
<TextBox
x:Name="popupText"
Margin="5,10,5,10"
Width="200"
Height="24"
Text="Enter Text..." />
<Button
Content="Click Me!"
Command="{commands:CloseWindowCommand}"
CommandParameter="{Binding}"
Margin="5,0,5,10"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</StackPanel>
</Border>
</tb:TaskbarIcon.TrayPopup>
</tb:TaskbarIcon>
<TextBlock
Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
Text="Left-Click NotifyIcon to open popup." />
<TextBlock
Text="Text on Popup: "
Margin="26,66,24,0"
VerticalAlignment="Top">
<TextBlock Foreground="Red"
Text="{Binding ElementName=popupText, Path=Text}" />
</TextBlock>
</Grid>
</Window>

View File

@@ -1,34 +1,34 @@
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.Shapes;
namespace Samples.Tutorials.Popups
{
/// <summary>
/// Interaction logic for InlinePopupWindow.xaml
/// </summary>
public partial class InlinePopupWindow : Window
{
public InlinePopupWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
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.Shapes;
namespace Samples.Tutorials.Popups
{
/// <summary>
/// Interaction logic for InlinePopupWindow.xaml
/// </summary>
public partial class InlinePopupWindow : Window
{
public InlinePopupWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,81 +1,81 @@
<Window x:Class="Samples.Tutorials.ContextMenus.InlineContextMenuWindow"
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"
xmlns:commands="clr-namespace:Samples.Commands"
Height="300"
Width="300">
<Grid>
<tb:TaskbarIcon x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world"
TrayContextMenuOpen="MyNotifyIcon_TrayContextMenuOpen"
PreviewTrayContextMenuOpen="MyNotifyIcon_PreviewTrayContextMenuOpen">
<!-- Set a simple context menu -->
<!-- the data context of the context menu is the NotifyIcon itself (see more about this in DataBinding samples) -->
<tb:TaskbarIcon.ContextMenu>
<ContextMenu>
<TextBlock Text="Hiding the sample window will not close it!" />
<MenuItem Header="_Show Sample Window [S]"
Command="{commands:ShowSampleWindowCommand}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<Image Width="16"
Height="16"
Source="/Images/Add.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="_Hide Sample Window [H]"
Command="{commands:HideSampleWindowCommand}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<Image Width="16"
Height="16"
Source="/Images/Remove.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run Language="de-ch"
Text="Right-click on NotifyIcon to open Context Menu" />
</TextBlock>
<TextBlock HorizontalAlignment="Left"
Margin="26,83,0,0"
TextWrapping="Wrap"
Text="Context menu preview open events:"
VerticalAlignment="Top" />
<TextBlock HorizontalAlignment="Left"
Margin="26,103.96,0,0"
TextWrapping="Wrap"
Text="Context menu open events:"
VerticalAlignment="Top" />
<TextBlock x:Name="PreviewOpenEventCounter"
HorizontalAlignment="Left"
Margin="246,83,0,0"
TextWrapping="Wrap"
Text="0"
VerticalAlignment="Top" />
<TextBlock x:Name="OpenEventCounter"
HorizontalAlignment="Left"
Margin="246,106.97,0,0"
TextWrapping="Wrap"
Text="0"
VerticalAlignment="Top" />
<CheckBox x:Name="SuppressContextMenu"
Content="Suppress context menu in preview event"
HorizontalAlignment="Left"
Margin="26,190,0,0"
VerticalAlignment="Top" />
</Grid>
<Window x:Class="Samples.Tutorials.ContextMenus.InlineContextMenuWindow"
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"
xmlns:commands="clr-namespace:Samples.Commands"
Height="300"
Width="300">
<Grid>
<tb:TaskbarIcon x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="hello world"
TrayContextMenuOpen="MyNotifyIcon_TrayContextMenuOpen"
PreviewTrayContextMenuOpen="MyNotifyIcon_PreviewTrayContextMenuOpen">
<!-- Set a simple context menu -->
<!-- the data context of the context menu is the NotifyIcon itself (see more about this in DataBinding samples) -->
<tb:TaskbarIcon.ContextMenu>
<ContextMenu>
<TextBlock Text="Hiding the sample window will not close it!" />
<MenuItem Header="_Show Sample Window [S]"
Command="{commands:ShowSampleWindowCommand}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<Image Width="16"
Height="16"
Source="/Images/Add.png" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="_Hide Sample Window [H]"
Command="{commands:HideSampleWindowCommand}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<Image Width="16"
Height="16"
Source="/Images/Remove.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run Language="de-ch"
Text="Right-click on NotifyIcon to open Context Menu" />
</TextBlock>
<TextBlock HorizontalAlignment="Left"
Margin="26,83,0,0"
TextWrapping="Wrap"
Text="Context menu preview open events:"
VerticalAlignment="Top" />
<TextBlock HorizontalAlignment="Left"
Margin="26,103.96,0,0"
TextWrapping="Wrap"
Text="Context menu open events:"
VerticalAlignment="Top" />
<TextBlock x:Name="PreviewOpenEventCounter"
HorizontalAlignment="Left"
Margin="246,83,0,0"
TextWrapping="Wrap"
Text="0"
VerticalAlignment="Top" />
<TextBlock x:Name="OpenEventCounter"
HorizontalAlignment="Left"
Margin="246,106.97,0,0"
TextWrapping="Wrap"
Text="0"
VerticalAlignment="Top" />
<CheckBox x:Name="SuppressContextMenu"
Content="Suppress context menu in preview event"
HorizontalAlignment="Left"
Margin="26,190,0,0"
VerticalAlignment="Top" />
</Grid>
</Window>

View File

@@ -1,40 +1,40 @@
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Samples.Tutorials.ContextMenus
{
/// <summary>
/// Interaction logic for InlineContextMenuWindow.xaml
/// </summary>
public partial class InlineContextMenuWindow : Window
{
public InlineContextMenuWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
private void MyNotifyIcon_TrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
{
OpenEventCounter.Text = (int.Parse(OpenEventCounter.Text) + 1).ToString();
}
private void MyNotifyIcon_PreviewTrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
{
//marking the event as handled suppresses the context menu
e.Handled = (bool) SuppressContextMenu.IsChecked;
PreviewOpenEventCounter.Text = (int.Parse(PreviewOpenEventCounter.Text) + 1).ToString();
}
}
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Samples.Tutorials.ContextMenus
{
/// <summary>
/// Interaction logic for InlineContextMenuWindow.xaml
/// </summary>
public partial class InlineContextMenuWindow : Window
{
public InlineContextMenuWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
private void MyNotifyIcon_TrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
{
OpenEventCounter.Text = (int.Parse(OpenEventCounter.Text) + 1).ToString();
}
private void MyNotifyIcon_PreviewTrayContextMenuOpen(object sender, System.Windows.RoutedEventArgs e)
{
//marking the event as handled suppresses the context menu
e.Handled = (bool) SuppressContextMenu.IsChecked;
PreviewOpenEventCounter.Text = (int.Parse(PreviewOpenEventCounter.Text) + 1).ToString();
}
}
}

View File

@@ -1,51 +1,51 @@
<Window
x:Class="Samples.Tutorials.Balloons.BalloonSampleWindow"
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="300"
Width="300">
<Grid>
<!-- the ToolTipText property is bound to the TextBox below -->
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="Balloon Sample Icon" />
<Button
x:Name="btnShowStandardBalloon"
Click="btnShowStandardBalloon_Click"
Margin="26,74,29,0"
Content="Show Standard Balloon" Height="29" VerticalAlignment="Top" />
<Button
x:Name="btnShowCustomBalloon"
Click="btnShowCustomBalloon_Click"
Margin="26,0,29,49"
VerticalAlignment="Bottom"
Height="27"
Content="Show Custom Balloon" />
<TextBlock
Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="Clicking on buttons shows balloon tips" />
</TextBlock>
<Button
x:Name="btnHideStandardBalloon"
Click="btnHideStandardBalloon_Click"
Margin="26,113,29,122"
Content="Hide Standard Balloon" />
<Button
x:Name="btnCloseCustomBalloon"
Click="btnCloseCustomBalloon_Click"
Margin="26,0,29,12"
VerticalAlignment="Bottom"
Height="27"
Content="Close Custom Balloon" />
</Grid>
<Window
x:Class="Samples.Tutorials.Balloons.BalloonSampleWindow"
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="300"
Width="300">
<Grid>
<!-- the ToolTipText property is bound to the TextBox below -->
<tb:TaskbarIcon
x:Name="MyNotifyIcon"
IconSource="/Icons/Error.ico"
ToolTipText="Balloon Sample Icon" />
<Button
x:Name="btnShowStandardBalloon"
Click="btnShowStandardBalloon_Click"
Margin="26,74,29,0"
Content="Show Standard Balloon" Height="29" VerticalAlignment="Top" />
<Button
x:Name="btnShowCustomBalloon"
Click="btnShowCustomBalloon_Click"
Margin="26,0,29,49"
VerticalAlignment="Bottom"
Height="27"
Content="Show Custom Balloon" />
<TextBlock
Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="Clicking on buttons shows balloon tips" />
</TextBlock>
<Button
x:Name="btnHideStandardBalloon"
Click="btnHideStandardBalloon_Click"
Margin="26,113,29,122"
Content="Hide Standard Balloon" />
<Button
x:Name="btnCloseCustomBalloon"
Click="btnCloseCustomBalloon_Click"
Margin="26,0,29,12"
VerticalAlignment="Bottom"
Height="27"
Content="Close Custom Balloon" />
</Grid>
</Window>

View File

@@ -1,65 +1,65 @@
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.Imaging;
using System.Windows.Shapes;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples.Tutorials.Balloons
{
/// <summary>
/// Interaction logic for BalloonSampleWindow.xaml
/// </summary>
public partial class BalloonSampleWindow : Window
{
public BalloonSampleWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
private void btnShowCustomBalloon_Click(object sender, RoutedEventArgs e)
{
FancyBalloon balloon = new FancyBalloon();
balloon.BalloonText = "Custom Balloon";
//show balloon and close it after 4 seconds
MyNotifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 4000);
}
private void btnHideStandardBalloon_Click(object sender, RoutedEventArgs e)
{
MyNotifyIcon.HideBalloonTip();
}
private void btnShowStandardBalloon_Click(object sender, RoutedEventArgs e)
{
string title = "WPF NotifyIcon";
string text = "This is a standard balloon";
MyNotifyIcon.ShowBalloonTip(title, text, MyNotifyIcon.Icon);
}
private void btnCloseCustomBalloon_Click(object sender, RoutedEventArgs e)
{
MyNotifyIcon.CloseBalloon();
}
}
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.Imaging;
using System.Windows.Shapes;
using Hardcodet.Wpf.TaskbarNotification;
namespace Samples.Tutorials.Balloons
{
/// <summary>
/// Interaction logic for BalloonSampleWindow.xaml
/// </summary>
public partial class BalloonSampleWindow : Window
{
public BalloonSampleWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
private void btnShowCustomBalloon_Click(object sender, RoutedEventArgs e)
{
FancyBalloon balloon = new FancyBalloon();
balloon.BalloonText = "Custom Balloon";
//show balloon and close it after 4 seconds
MyNotifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 4000);
}
private void btnHideStandardBalloon_Click(object sender, RoutedEventArgs e)
{
MyNotifyIcon.HideBalloonTip();
}
private void btnShowStandardBalloon_Click(object sender, RoutedEventArgs e)
{
string title = "WPF NotifyIcon";
string text = "This is a standard balloon";
MyNotifyIcon.ShowBalloonTip(title, text, MyNotifyIcon.Icon);
}
private void btnCloseCustomBalloon_Click(object sender, RoutedEventArgs e)
{
MyNotifyIcon.CloseBalloon();
}
}
}

View File

@@ -1,64 +1,64 @@
<Window
x:Class="Samples.Tutorials.Commands.CommandWindow"
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"
xmlns:local="clr-namespace:Samples.Tutorials.Commands"
Height="300"
Width="300"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<!-- declare the command as a local resource -->
<Grid.Resources>
<local:ShowMessageCommand
x:Key="MessageCommand" />
</Grid.Resources>
<!-- declare the NotifyIcon and configure commands with parameters -->
<tb:TaskbarIcon
x:Name="CustomCommandNotifyIcon"
IconSource="/Icons/Error.ico"
LeftClickCommand="{StaticResource MessageCommand}"
LeftClickCommandParameter="Left mouse button was clicked"
DoubleClickCommand="{StaticResource MessageCommand}"
DoubleClickCommandParameter="Double click on NotifyIcon" />
<!-- declare the NotifyIcon and configure commands with targets -->
<tb:TaskbarIcon
x:Name="RoutedCommandNotifyIcon"
IconSource="/Icons/Inactive.ico"
LeftClickCommand="ApplicationCommands.Cut"
LeftClickCommandTarget="{Binding ElementName=txtInput}"
DoubleClickCommand="ApplicationCommands.Paste"
DoubleClickCommandTarget="{Binding ElementName=txtInput}" />
<TextBlock
Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="Left / Double clicks on red NotifyIcon executes simple custom commands." />
</TextBlock>
<TextBlock
Margin="26,112,24,80"
FontWeight="Bold"
TextWrapping="Wrap">
<Run Language="de-ch" Text="Left / Double clicks on grey NotifyIcon executes routed commands." />
<LineBreak /><Run Language="de-ch" Text="Single click: Cuts selected text" /><LineBreak />
<Run Language="de-ch" Text="Double click: Paste text from clipboard" />
</TextBlock>
<TextBox
Margin="26,0,24,48"
VerticalAlignment="Bottom"
Height="22"
Text="hello world"
TextWrapping="Wrap"
x:Name="txtInput" />
</Grid>
<Window
x:Class="Samples.Tutorials.Commands.CommandWindow"
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"
xmlns:local="clr-namespace:Samples.Tutorials.Commands"
Height="300"
Width="300"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<!-- declare the command as a local resource -->
<Grid.Resources>
<local:ShowMessageCommand
x:Key="MessageCommand" />
</Grid.Resources>
<!-- declare the NotifyIcon and configure commands with parameters -->
<tb:TaskbarIcon
x:Name="CustomCommandNotifyIcon"
IconSource="/Icons/Error.ico"
LeftClickCommand="{StaticResource MessageCommand}"
LeftClickCommandParameter="Left mouse button was clicked"
DoubleClickCommand="{StaticResource MessageCommand}"
DoubleClickCommandParameter="Double click on NotifyIcon" />
<!-- declare the NotifyIcon and configure commands with targets -->
<tb:TaskbarIcon
x:Name="RoutedCommandNotifyIcon"
IconSource="/Icons/Inactive.ico"
LeftClickCommand="ApplicationCommands.Cut"
LeftClickCommandTarget="{Binding ElementName=txtInput}"
DoubleClickCommand="ApplicationCommands.Paste"
DoubleClickCommandTarget="{Binding ElementName=txtInput}" />
<TextBlock
Margin="26,26,24,0"
VerticalAlignment="Top"
FontWeight="Bold"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="Left / Double clicks on red NotifyIcon executes simple custom commands." />
</TextBlock>
<TextBlock
Margin="26,112,24,80"
FontWeight="Bold"
TextWrapping="Wrap">
<Run Language="de-ch" Text="Left / Double clicks on grey NotifyIcon executes routed commands." />
<LineBreak /><Run Language="de-ch" Text="Single click: Cuts selected text" /><LineBreak />
<Run Language="de-ch" Text="Double click: Paste text from clipboard" />
</TextBlock>
<TextBox
Margin="26,0,24,48"
VerticalAlignment="Bottom"
Height="22"
Text="hello world"
TextWrapping="Wrap"
x:Name="txtInput" />
</Grid>
</Window>

View File

@@ -1,36 +1,36 @@
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.Shapes;
namespace Samples.Tutorials.Commands
{
/// <summary>
/// Interaction logic for CommandWindow.xaml
/// </summary>
public partial class CommandWindow : Window
{
public CommandWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
CustomCommandNotifyIcon.Dispose();
RoutedCommandNotifyIcon.Dispose();
base.OnClosing(e);
}
}
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.Shapes;
namespace Samples.Tutorials.Commands
{
/// <summary>
/// Interaction logic for CommandWindow.xaml
/// </summary>
public partial class CommandWindow : Window
{
public CommandWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
CustomCommandNotifyIcon.Dispose();
RoutedCommandNotifyIcon.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,25 +1,25 @@
using System;
using System.Windows;
using System.Windows.Input;
namespace Samples.Tutorials.Commands
{
/// <summary>
/// A simple command that displays the command parameter as
/// a dialog message.
/// </summary>
public class ShowMessageCommand : ICommand
{
public void Execute(object parameter)
{
MessageBox.Show(parameter.ToString());
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
}
using System;
using System.Windows;
using System.Windows.Input;
namespace Samples.Tutorials.Commands
{
/// <summary>
/// A simple command that displays the command parameter as
/// a dialog message.
/// </summary>
public class ShowMessageCommand : ICommand
{
public void Execute(object parameter)
{
MessageBox.Show(parameter.ToString());
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
}
}

View File

@@ -1,265 +1,265 @@
<Window
x:Class="Samples.Tutorials.Events.EventVisualizerWindow"
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="300"
Width="300">
<Window.Resources>
<Storyboard
x:Key="ShowMovement"
AutoReverse="True">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="MoveIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.2" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="MoveIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.2" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard
x:Key="ShowMouseUp"
AutoReverse="True">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="LeftMouseIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.35" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="LeftMouseIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.35" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard
x:Key="ShowToolTipOpened"
AutoReverse="True">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="ToolTipIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.2000000"
Value="1.4" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="ToolTipIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.2000000"
Value="1.4" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger
RoutedEvent="tb:TaskbarIcon.TrayMouseMove"
SourceName="notifyIcon">
<BeginStoryboard
Storyboard="{StaticResource ShowMovement}" />
</EventTrigger>
<EventTrigger
RoutedEvent="tb:TaskbarIcon.TrayLeftMouseUp"
SourceName="notifyIcon">
<BeginStoryboard
Storyboard="{StaticResource ShowMouseUp}"
x:Name="ShowMouseUp_BeginStoryboard" />
</EventTrigger>
<EventTrigger
RoutedEvent="tb:TaskbarIcon.TrayToolTipOpen"
SourceName="notifyIcon">
<BeginStoryboard
Storyboard="{StaticResource ShowToolTipOpened}"
x:Name="ShowToolTipOpened_BeginStoryboard" />
</EventTrigger>
</Window.Triggers>
<Grid>
<!-- the NotifyIcon does not need to be configured here - animations were set up in Blend -->
<tb:TaskbarIcon
x:Name="notifyIcon"
ToolTipText="hello world"
IconSource="/Icons/Error.ico" />
<Ellipse
HorizontalAlignment="Left"
Margin="24,62,0,0"
VerticalAlignment="Top"
Width="19"
Height="19"
Stroke="#FF549D2D"
x:Name="MoveIndicator"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform
ScaleX="1"
ScaleY="1" />
<SkewTransform
AngleX="0"
AngleY="0" />
<RotateTransform
Angle="0" />
<TranslateTransform
X="0"
Y="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush
EndPoint="0.528,0.694"
StartPoint="-0.056,-0.118">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FF65A135"
Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse
Stroke="#FF549D2D"
HorizontalAlignment="Left"
Margin="24,106,0,0"
VerticalAlignment="Top"
Width="19"
Height="19"
x:Name="LeftMouseIndicator"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform
AngleX="0"
AngleY="0" />
<RotateTransform
Angle="0" />
<TranslateTransform
X="0"
Y="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush
EndPoint="0.528,0.694"
StartPoint="-0.056,-0.118">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FF65A135"
Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse
Stroke="#FF549D2D"
HorizontalAlignment="Left"
Margin="24,0,0,94"
Width="19"
x:Name="ToolTipIndicator"
RenderTransformOrigin="0.5,0.5"
Height="19"
VerticalAlignment="Bottom">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform
ScaleX="1"
ScaleY="1" />
<SkewTransform
AngleX="0"
AngleY="0" />
<RotateTransform
Angle="0" />
<TranslateTransform
X="0"
Y="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush
EndPoint="0.528,0.694"
StartPoint="-0.056,-0.118">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FF65A135"
Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock
Margin="63,62,91,0"
VerticalAlignment="Top"
Height="19"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="TrayMouseMove Event" />
</TextBlock>
<TextBlock
Margin="63,106,91,0"
VerticalAlignment="Top"
Height="19"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="TrayLeftMouseUp Event" />
</TextBlock>
<TextBlock
Margin="63,0,91,94"
TextWrapping="Wrap"
VerticalAlignment="Bottom"
Height="19">
<Run
Language="de-ch"
Text="TrayToolTipOpen Event" />
</TextBlock>
<TextBlock
Margin="10,10,10,0"
VerticalAlignment="Top"
Height="31"
TextWrapping="Wrap"
FontWeight="Bold">
<Run Language="de-ch" Text="The green ellipses are animated based on routed events of the NotifyIcon" />
</TextBlock>
</Grid>
<Window
x:Class="Samples.Tutorials.Events.EventVisualizerWindow"
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="300"
Width="300">
<Window.Resources>
<Storyboard
x:Key="ShowMovement"
AutoReverse="True">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="MoveIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.2" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="MoveIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.2" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard
x:Key="ShowMouseUp"
AutoReverse="True">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="LeftMouseIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.35" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="LeftMouseIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.1000000"
Value="1.35" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard
x:Key="ShowToolTipOpened"
AutoReverse="True">
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="ToolTipIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.2000000"
Value="1.4" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="ToolTipIndicator"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame
KeyTime="00:00:00"
Value="1" />
<SplineDoubleKeyFrame
KeyTime="00:00:00.2000000"
Value="1.4" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger
RoutedEvent="tb:TaskbarIcon.TrayMouseMove"
SourceName="notifyIcon">
<BeginStoryboard
Storyboard="{StaticResource ShowMovement}" />
</EventTrigger>
<EventTrigger
RoutedEvent="tb:TaskbarIcon.TrayLeftMouseUp"
SourceName="notifyIcon">
<BeginStoryboard
Storyboard="{StaticResource ShowMouseUp}"
x:Name="ShowMouseUp_BeginStoryboard" />
</EventTrigger>
<EventTrigger
RoutedEvent="tb:TaskbarIcon.TrayToolTipOpen"
SourceName="notifyIcon">
<BeginStoryboard
Storyboard="{StaticResource ShowToolTipOpened}"
x:Name="ShowToolTipOpened_BeginStoryboard" />
</EventTrigger>
</Window.Triggers>
<Grid>
<!-- the NotifyIcon does not need to be configured here - animations were set up in Blend -->
<tb:TaskbarIcon
x:Name="notifyIcon"
ToolTipText="hello world"
IconSource="/Icons/Error.ico" />
<Ellipse
HorizontalAlignment="Left"
Margin="24,62,0,0"
VerticalAlignment="Top"
Width="19"
Height="19"
Stroke="#FF549D2D"
x:Name="MoveIndicator"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform
ScaleX="1"
ScaleY="1" />
<SkewTransform
AngleX="0"
AngleY="0" />
<RotateTransform
Angle="0" />
<TranslateTransform
X="0"
Y="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush
EndPoint="0.528,0.694"
StartPoint="-0.056,-0.118">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FF65A135"
Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse
Stroke="#FF549D2D"
HorizontalAlignment="Left"
Margin="24,106,0,0"
VerticalAlignment="Top"
Width="19"
Height="19"
x:Name="LeftMouseIndicator"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform
AngleX="0"
AngleY="0" />
<RotateTransform
Angle="0" />
<TranslateTransform
X="0"
Y="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush
EndPoint="0.528,0.694"
StartPoint="-0.056,-0.118">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FF65A135"
Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse
Stroke="#FF549D2D"
HorizontalAlignment="Left"
Margin="24,0,0,94"
Width="19"
x:Name="ToolTipIndicator"
RenderTransformOrigin="0.5,0.5"
Height="19"
VerticalAlignment="Bottom">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform
ScaleX="1"
ScaleY="1" />
<SkewTransform
AngleX="0"
AngleY="0" />
<RotateTransform
Angle="0" />
<TranslateTransform
X="0"
Y="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush
EndPoint="0.528,0.694"
StartPoint="-0.056,-0.118">
<GradientStop
Color="#FFFFFFFF"
Offset="0" />
<GradientStop
Color="#FF65A135"
Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock
Margin="63,62,91,0"
VerticalAlignment="Top"
Height="19"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="TrayMouseMove Event" />
</TextBlock>
<TextBlock
Margin="63,106,91,0"
VerticalAlignment="Top"
Height="19"
TextWrapping="Wrap">
<Run
Language="de-ch"
Text="TrayLeftMouseUp Event" />
</TextBlock>
<TextBlock
Margin="63,0,91,94"
TextWrapping="Wrap"
VerticalAlignment="Bottom"
Height="19">
<Run
Language="de-ch"
Text="TrayToolTipOpen Event" />
</TextBlock>
<TextBlock
Margin="10,10,10,0"
VerticalAlignment="Top"
Height="31"
TextWrapping="Wrap"
FontWeight="Bold">
<Run Language="de-ch" Text="The green ellipses are animated based on routed events of the NotifyIcon" />
</TextBlock>
</Grid>
</Window>

View File

@@ -1,24 +1,24 @@
using System.Windows;
namespace Samples.Tutorials.Events
{
/// <summary>
/// Interaction logic for EventVisualizerWindow.xaml
/// </summary>
public partial class EventVisualizerWindow : Window
{
public EventVisualizerWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
notifyIcon.Dispose();
base.OnClosing(e);
}
}
using System.Windows;
namespace Samples.Tutorials.Events
{
/// <summary>
/// Interaction logic for EventVisualizerWindow.xaml
/// </summary>
public partial class EventVisualizerWindow : Window
{
public EventVisualizerWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
notifyIcon.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,91 +1,91 @@
<Window x:Class="Samples.Tutorials.DataBinding.DataBoundToolTipWindow"
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="300"
Width="500">
<Grid>
<!-- the ToolTipText property is bound to the TextBox below -->
<tb:TaskbarIcon x:Name="MyNotifyIcon1"
IconSource="/Icons/Error.ico"
ToolTipText="{Binding ElementName=txtToolTip, Path=Text}">
<!--
The TextBlock bound to the ToolTipText property of the NotifyIcon
The binding is implicit (using DataContext)
-->
<tb:TaskbarIcon.TrayToolTip>
<Border Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<TextBlock Text="{Binding Path=ToolTipText}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<!-- This NotifyIcon has its DataContext set (just the string "WPF FTW") - implicit binding is no longer possible -->
<tb:TaskbarIcon x:Name="MyNotifyIcon2"
DataContext="WPF FTW "
IconSource="/Icons/Inactive.ico"
ToolTipText="{Binding ElementName=txtToolTip, Path=Text}">
<tb:TaskbarIcon.TrayToolTip>
<!--
Important: The attached property is assigned to the border, but derived by all controls.
The NotifyIcon does not touch the underlying controls.
-->
<Border Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<!-- Implicitly access the DataContext (which is a string this time)-->
<TextBlock Text="{Binding}">
<!-- Explicitly access the NotifyIcon, as it is an attached property -->
<TextBlock Text="{Binding RelativeSource={RelativeSource Self},
Path=(tb:TaskbarIcon.ParentTaskbarIcon).ToolTipText}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</TextBlock>
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0"
VerticalAlignment="Top"
TextWrapping="Wrap"
FontWeight="Bold">
<Run Text="This sample shows data bound ToolTips in two flavors" /><LineBreak /><Run Text="" />
<LineBreak /><Run Text="- implicit binding via DataContext" /><LineBreak />
<Run Text="- explicit binding via ParentTaskbarIcon (attached property)" /><LineBreak /><Run Text="" />
<LineBreak /><Run Text="Move over NotifyIcons (grey / red) to show data bound ToolTip" />
</TextBlock>
<TextBox Margin="26,0,24,10"
Text="hello world"
TextWrapping="Wrap"
x:Name="txtToolTip"
Height="25"
VerticalAlignment="Bottom" />
<TextBlock Margin="26,0,125,45"
VerticalAlignment="Bottom"
Height="26"
TextWrapping="Wrap">
<Run Text="ToolTipText:" />
</TextBlock>
</Grid>
<Window x:Class="Samples.Tutorials.DataBinding.DataBoundToolTipWindow"
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="300"
Width="500">
<Grid>
<!-- the ToolTipText property is bound to the TextBox below -->
<tb:TaskbarIcon x:Name="MyNotifyIcon1"
IconSource="/Icons/Error.ico"
ToolTipText="{Binding ElementName=txtToolTip, Path=Text}">
<!--
The TextBlock bound to the ToolTipText property of the NotifyIcon
The binding is implicit (using DataContext)
-->
<tb:TaskbarIcon.TrayToolTip>
<Border Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<TextBlock Text="{Binding Path=ToolTipText}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<!-- This NotifyIcon has its DataContext set (just the string "WPF FTW") - implicit binding is no longer possible -->
<tb:TaskbarIcon x:Name="MyNotifyIcon2"
DataContext="WPF FTW "
IconSource="/Icons/Inactive.ico"
ToolTipText="{Binding ElementName=txtToolTip, Path=Text}">
<tb:TaskbarIcon.TrayToolTip>
<!--
Important: The attached property is assigned to the border, but derived by all controls.
The NotifyIcon does not touch the underlying controls.
-->
<Border Background="White"
BorderBrush="Orange"
BorderThickness="2"
CornerRadius="4"
Opacity="0.8"
Width="160"
Height="40">
<!-- Implicitly access the DataContext (which is a string this time)-->
<TextBlock Text="{Binding}">
<!-- Explicitly access the NotifyIcon, as it is an attached property -->
<TextBlock Text="{Binding RelativeSource={RelativeSource Self},
Path=(tb:TaskbarIcon.ParentTaskbarIcon).ToolTipText}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</TextBlock>
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
<TextBlock Margin="26,26,24,0"
VerticalAlignment="Top"
TextWrapping="Wrap"
FontWeight="Bold">
<Run Text="This sample shows data bound ToolTips in two flavors" /><LineBreak /><Run Text="" />
<LineBreak /><Run Text="- implicit binding via DataContext" /><LineBreak />
<Run Text="- explicit binding via ParentTaskbarIcon (attached property)" /><LineBreak /><Run Text="" />
<LineBreak /><Run Text="Move over NotifyIcons (grey / red) to show data bound ToolTip" />
</TextBlock>
<TextBox Margin="26,0,24,10"
Text="hello world"
TextWrapping="Wrap"
x:Name="txtToolTip"
Height="25"
VerticalAlignment="Bottom" />
<TextBlock Margin="26,0,125,45"
VerticalAlignment="Bottom"
Height="26"
TextWrapping="Wrap">
<Run Text="ToolTipText:" />
</TextBlock>
</Grid>
</Window>

View File

@@ -1,25 +1,25 @@
using System.Windows;
namespace Samples.Tutorials.DataBinding
{
/// <summary>
/// Interaction logic for DataBoundToolTipWindow.xaml
/// </summary>
public partial class DataBoundToolTipWindow : Window
{
public DataBoundToolTipWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon1.Dispose();
MyNotifyIcon2.Dispose();
base.OnClosing(e);
}
}
using System.Windows;
namespace Samples.Tutorials.DataBinding
{
/// <summary>
/// Interaction logic for DataBoundToolTipWindow.xaml
/// </summary>
public partial class DataBoundToolTipWindow : Window
{
public DataBoundToolTipWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon1.Dispose();
MyNotifyIcon2.Dispose();
base.OnClosing(e);
}
}
}

View File

@@ -1,37 +1,37 @@
<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"
mc:Ignorable="d"
x:Class="Samples.Tutorials.MvvmSample.ClockPopup"
x:Name="UserControl"
Height="141"
Width="304">
<UserControl.Background>
<LinearGradientBrush EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="#FFA8A8A8"
Offset="0" />
<GradientStop Color="White"
Offset="1" />
</LinearGradientBrush>
</UserControl.Background>
<Grid x:Name="LayoutRoot">
<Rectangle Stroke="#FF727272"/>
<Image Source="Clock.png"
Stretch="Fill"
Height="128"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Width="128"
Margin="10,10,0,0" />
<TextBlock HorizontalAlignment="Left"
Margin="143,0,0,0"
TextWrapping="Wrap"
Text="{Binding Timestamp}"
VerticalAlignment="Center"
FontSize="40"
Foreground="#F2346172" />
</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"
mc:Ignorable="d"
x:Class="Samples.Tutorials.MvvmSample.ClockPopup"
x:Name="UserControl"
Height="141"
Width="304">
<UserControl.Background>
<LinearGradientBrush EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="#FFA8A8A8"
Offset="0" />
<GradientStop Color="White"
Offset="1" />
</LinearGradientBrush>
</UserControl.Background>
<Grid x:Name="LayoutRoot">
<Rectangle Stroke="#FF727272"/>
<Image Source="Clock.png"
Stretch="Fill"
Height="128"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Width="128"
Margin="10,10,0,0" />
<TextBlock HorizontalAlignment="Left"
Margin="143,0,0,0"
TextWrapping="Wrap"
Text="{Binding Timestamp}"
VerticalAlignment="Center"
FontSize="40"
Foreground="#F2346172" />
</Grid>
</UserControl>

View File

@@ -1,15 +1,15 @@
using System.Windows.Controls;
namespace Samples.Tutorials.MvvmSample
{
/// <summary>
/// Interaction logic for ClockPopup.xaml
/// </summary>
public partial class ClockPopup : UserControl
{
public ClockPopup()
{
this.InitializeComponent();
}
}
using System.Windows.Controls;
namespace Samples.Tutorials.MvvmSample
{
/// <summary>
/// Interaction logic for ClockPopup.xaml
/// </summary>
public partial class ClockPopup : UserControl
{
public ClockPopup()
{
this.InitializeComponent();
}
}
}

View File

@@ -1,38 +1,38 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Threading;
namespace Samples.Tutorials.MvvmSample
{
public class MvvmSampleViewModel : INotifyPropertyChanged
{
private DispatcherTimer timer;
public string Timestamp
{
get { return DateTime.Now.ToLongTimeString(); }
}
public MvvmSampleViewModel()
{
timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerTick, Application.Current.Dispatcher);
}
private void OnTimerTick(object sender, EventArgs e)
{
//fire a property change event for the timestamp
Application.Current.Dispatcher.BeginInvoke(new Action(() => OnPropertyChanged("Timestamp")));
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Threading;
namespace Samples.Tutorials.MvvmSample
{
public class MvvmSampleViewModel : INotifyPropertyChanged
{
private DispatcherTimer timer;
public string Timestamp
{
get { return DateTime.Now.ToLongTimeString(); }
}
public MvvmSampleViewModel()
{
timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerTick, Application.Current.Dispatcher);
}
private void OnTimerTick(object sender, EventArgs e)
{
//fire a property change event for the timestamp
Application.Current.Dispatcher.BeginInvoke(new Action(() => OnPropertyChanged("Timestamp")));
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -1,37 +1,37 @@
<Window x:Class="Samples.Tutorials.MvvmSample.MvvmSampleWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Samples.Tutorials.MvvmSample"
xmlns:tb="http://www.hardcodet.net/taskbar"
Title="MvvmSampleWindow"
Height="300"
Width="300">
<Window.DataContext>
<local:MvvmSampleViewModel />
</Window.DataContext>
<Grid>
<!--
the NotifyIcon automatically derives the DataContext of it's
declaring view. Alternatively, you could just assign it manually
-->
<tb:TaskbarIcon IconSource="/Icons/Inactive.ico"
ToolTipText="{Binding Timestamp}">
<tb:TaskbarIcon.TrayPopup >
<!-- the popup, here a custom user control, will also get the DataContext of the NotifyIcon -->
<local:ClockPopup Opacity="0.8" />
</tb:TaskbarIcon.TrayPopup>
</tb:TaskbarIcon>
<TextBlock TextWrapping="Wrap"
Text="MVVM is quite simple - content of the NotifyIcon derive its DataContext. Sample: Hover over the icon in order to see the bound ToolTipText. Click for a richer Popup that is bound to the same property."
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="10,10,10,0" />
</Grid>
</Window>
<Window x:Class="Samples.Tutorials.MvvmSample.MvvmSampleWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Samples.Tutorials.MvvmSample"
xmlns:tb="http://www.hardcodet.net/taskbar"
Title="MvvmSampleWindow"
Height="300"
Width="300">
<Window.DataContext>
<local:MvvmSampleViewModel />
</Window.DataContext>
<Grid>
<!--
the NotifyIcon automatically derives the DataContext of it's
declaring view. Alternatively, you could just assign it manually
-->
<tb:TaskbarIcon IconSource="/Icons/Inactive.ico"
ToolTipText="{Binding Timestamp}">
<tb:TaskbarIcon.TrayPopup >
<!-- the popup, here a custom user control, will also get the DataContext of the NotifyIcon -->
<local:ClockPopup Opacity="0.8" />
</tb:TaskbarIcon.TrayPopup>
</tb:TaskbarIcon>
<TextBlock TextWrapping="Wrap"
Text="MVVM is quite simple - content of the NotifyIcon derive its DataContext. Sample: Hover over the icon in order to see the bound ToolTipText. Click for a richer Popup that is bound to the same property."
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="10,10,10,0" />
</Grid>
</Window>

View File

@@ -1,15 +1,15 @@
using System.Windows;
namespace Samples.Tutorials.MvvmSample
{
/// <summary>
/// Interaction logic for MvvmSampleWindow.xaml
/// </summary>
public partial class MvvmSampleWindow : Window
{
public MvvmSampleWindow()
{
InitializeComponent();
}
}
}
using System.Windows;
namespace Samples.Tutorials.MvvmSample
{
/// <summary>
/// Interaction logic for MvvmSampleWindow.xaml
/// </summary>
public partial class MvvmSampleWindow : Window
{
public MvvmSampleWindow()
{
InitializeComponent();
}
}
}