mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-22 17:29:12 -05:00
NotifyWPF
--------- CHG Lot of plumbing, some fixes CHG Work on sample project. CHG Popups and ContextMenu now store coordinates - otherwise delayed opending may happen elsewhere. git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@55 9f600761-6f11-4665-b6dc-0185e9171623
This commit is contained in:
@@ -4,5 +4,11 @@
|
||||
StartupUri="Window1.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="TaskbarIconResources.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
39
Source/Sample Project/Commands/HideMainWindowCommand.cs
Normal file
39
Source/Sample Project/Commands/HideMainWindowCommand.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Sample_Project.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// Hides the main window.
|
||||
/// </summary>
|
||||
public class HideMainWindowCommand : ICommand
|
||||
{
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
Application.Current.MainWindow.Hide();
|
||||
TaskbarIconCommands.RefreshCommands();
|
||||
}
|
||||
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return Application.Current.MainWindow.IsVisible;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="CanExecuteChanged"/> event.
|
||||
/// </summary>
|
||||
internal void RaiseCanExcecuteChanged()
|
||||
{
|
||||
if (CanExecuteChanged != null) CanExecuteChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
38
Source/Sample Project/Commands/ShowMainWindowCommand.cs
Normal file
38
Source/Sample Project/Commands/ShowMainWindowCommand.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Sample_Project.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// Shows the main window.
|
||||
/// </summary>
|
||||
public class ShowMainWindowCommand : ICommand
|
||||
{
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
Application.Current.MainWindow.Show();
|
||||
TaskbarIconCommands.RefreshCommands();
|
||||
}
|
||||
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return Application.Current.MainWindow.IsVisible == false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="CanExecuteChanged"/> event.
|
||||
/// </summary>
|
||||
internal void RaiseCanExcecuteChanged()
|
||||
{
|
||||
if (CanExecuteChanged != null) CanExecuteChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
27
Source/Sample Project/Commands/TaskbarIconCommands.cs
Normal file
27
Source/Sample Project/Commands/TaskbarIconCommands.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Sample_Project.Commands
|
||||
{
|
||||
public static class TaskbarIconCommands
|
||||
{
|
||||
public static HideMainWindowCommand HideMain { get; set; }
|
||||
public static ShowMainWindowCommand ShowMain { get; set; }
|
||||
|
||||
|
||||
static TaskbarIconCommands()
|
||||
{
|
||||
HideMain = new HideMainWindowCommand();
|
||||
ShowMain =new ShowMainWindowCommand();
|
||||
}
|
||||
|
||||
public static void RefreshCommands()
|
||||
{
|
||||
HideMain.RaiseCanExcecuteChanged();
|
||||
ShowMain.RaiseCanExcecuteChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
92
Source/Sample Project/FancyPopup.xaml
Normal file
92
Source/Sample Project/FancyPopup.xaml
Normal file
@@ -0,0 +1,92 @@
|
||||
<UserControl
|
||||
x:Class="Sample_Project.FancyPopup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Height="215"
|
||||
Width="300" x:Name="me">
|
||||
<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" />
|
||||
<TextBlock
|
||||
Margin="107,10,20,0"
|
||||
TextWrapping="Wrap"
|
||||
Height="32"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#FF575757"><Run
|
||||
Text="This is a fancy Popup..."
|
||||
Language="de-ch" /></TextBlock>
|
||||
<Button
|
||||
Click="OnButtonClick"
|
||||
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="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sed sem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla dui nisi, venenatis" /><Run
|
||||
Text="."
|
||||
Language="de-ch" /></TextBlock>
|
||||
<TextBlock Margin="0,52,20,0" VerticalAlignment="Top" Height="30" 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>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
46
Source/Sample Project/FancyPopup.xaml.cs
Normal file
46
Source/Sample Project/FancyPopup.xaml.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Sample_Project
|
||||
{
|
||||
/// <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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Source/Sample Project/FancyToolTip.xaml
Normal file
68
Source/Sample Project/FancyToolTip.xaml
Normal file
@@ -0,0 +1,68 @@
|
||||
<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="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification"
|
||||
mc:Ignorable="d"
|
||||
x:Class="Sample_Project.FancyToolTip"
|
||||
x:Name="me"
|
||||
Width="285"
|
||||
Height="108">
|
||||
|
||||
<Grid
|
||||
x:Name="LayoutRoot">
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
CornerRadius="6,6,6,6"
|
||||
BorderThickness="3,3,3,3"
|
||||
Margin="0,0,5,5">
|
||||
<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" />
|
||||
<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="Normal"
|
||||
Foreground="#FF141414"
|
||||
TextWrapping="Wrap"
|
||||
Margin="82,52,20,0"
|
||||
VerticalAlignment="Top"
|
||||
Text="{Binding ElementName=me, Path=InfoText}"
|
||||
x:Name="txtToolTipDetail" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
80
Source/Sample Project/FancyToolTip.xaml.cs
Normal file
80
Source/Sample Project/FancyToolTip.xaml.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
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;
|
||||
|
||||
namespace Sample_Project
|
||||
{
|
||||
/// <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("", InfoTextPropertyChanged));
|
||||
|
||||
/// <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); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A static callback listener which is being invoked if the
|
||||
/// <see cref="InfoTextProperty"/> dependency property has
|
||||
/// been changed. Invokes the <see cref="OnInfoTextPropertyChanged"/>
|
||||
/// instance method of the changed instance.
|
||||
/// </summary>
|
||||
/// <param name="d">The currently processed owner of the property.</param>
|
||||
/// <param name="e">Provides information about the updated property.</param>
|
||||
private static void InfoTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
FancyToolTip owner = (FancyToolTip) d;
|
||||
owner.OnInfoTextPropertyChanged(e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles changes of the <see cref="InfoTextProperty"/> dependency property. As
|
||||
/// WPF internally uses the dependency property system and bypasses the
|
||||
/// <see cref="InfoText"/> property wrapper, updates of the property's value
|
||||
/// should be handled here.
|
||||
/// </summary
|
||||
/// <param name="e">Provides information about the updated property.</param>
|
||||
private void OnInfoTextPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
// string newValue = (string) e.NewValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
public FancyToolTip()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Source/Sample Project/Icons/Error.ico
Normal file
BIN
Source/Sample Project/Icons/Error.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Source/Sample Project/Icons/Inactive.ico
Normal file
BIN
Source/Sample Project/Icons/Inactive.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Source/Sample Project/Images/Add.png
Normal file
BIN
Source/Sample Project/Images/Add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 502 B |
BIN
Source/Sample Project/Images/Info.png
Normal file
BIN
Source/Sample Project/Images/Info.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
BIN
Source/Sample Project/Images/Remove.png
Normal file
BIN
Source/Sample Project/Images/Remove.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 237 B |
BIN
Source/Sample Project/Images/preferences.png
Normal file
BIN
Source/Sample Project/Images/preferences.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -33,6 +33,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationFramework.Aero" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
@@ -46,29 +47,63 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<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="FancyToolTip.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="TaskbarIconResources.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="FancyToolTip.xaml.cs">
|
||||
<DependentUpon>FancyToolTip.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="FancyPopup.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Window1.xaml.cs">
|
||||
<DependentUpon>Window1.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>Window1.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands\TaskbarIconCommands.cs" />
|
||||
<Compile Include="Commands\HideMainWindowCommand.cs" />
|
||||
<Compile Include="Commands\ShowMainWindowCommand.cs" />
|
||||
<Compile Include="FancyPopup.xaml.cs">
|
||||
<DependentUpon>FancyPopup.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -79,8 +114,8 @@
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
@@ -107,6 +142,10 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Icons\Computers.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Add.png" />
|
||||
<Resource Include="Images\Remove.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Samples\" />
|
||||
</ItemGroup>
|
||||
|
||||
142
Source/Sample Project/TaskbarIconResources.xaml
Normal file
142
Source/Sample Project/TaskbarIconResources.xaml
Normal file
@@ -0,0 +1,142 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Commands="clr-namespace:Sample_Project.Commands"
|
||||
xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification"
|
||||
>
|
||||
<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}">
|
||||
<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>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- The taskbar context menu -->
|
||||
<ContextMenu
|
||||
x:Key="tbMenu">
|
||||
<MenuItem
|
||||
Header="Show Main Window"
|
||||
Command="{Binding Source={x:Static Commands:TaskbarIconCommands.ShowMain}}">
|
||||
<MenuItem.Icon>
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Add.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem
|
||||
Header="Hide Main Window"
|
||||
Command="{Binding Source={x:Static Commands:TaskbarIconCommands.HideMain}}">
|
||||
<MenuItem.Icon>
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Remove.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
|
||||
|
||||
<ToolTip
|
||||
x:Key="tbToolTip"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
HasDropShadow="False"
|
||||
VerticalOffset="-10"
|
||||
>
|
||||
<Grid
|
||||
>
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
CornerRadius="6,6,6,6"
|
||||
BorderThickness="3,3,3,3"
|
||||
Margin="0,0,5,5">
|
||||
<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" />
|
||||
<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="Normal"
|
||||
Foreground="#FF141414"
|
||||
TextWrapping="Wrap"
|
||||
Margin="82,52,20,0"
|
||||
VerticalAlignment="Top"
|
||||
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type tb:TaskbarIcon}}, Path=ToolTipText}"
|
||||
/>
|
||||
</Grid>
|
||||
</ToolTip>
|
||||
|
||||
<!--
|
||||
As we don't declare the popup with the control, use
|
||||
commands to trigger an action.
|
||||
-->
|
||||
<Popup
|
||||
x:Key="tbPopupSimple"
|
||||
PopupAnimation="Slide"
|
||||
Placement="Mouse"
|
||||
AllowsTransparency="True"
|
||||
StaysOpen="False"
|
||||
>
|
||||
<Border
|
||||
Width="200"
|
||||
Height="200"
|
||||
Background="Red">
|
||||
<Button>Click me</Button>
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -2,146 +2,437 @@
|
||||
x:Class="Sample_Project.Window1"
|
||||
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"
|
||||
Title="Window1" Height="480" Width="579">
|
||||
<Window.Resources>
|
||||
<Storyboard x:Key="OnTaskbarIconLeftMouseUp1">
|
||||
<BooleanAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="popup" Storyboard.TargetProperty="(Popup.IsOpen)">
|
||||
<DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="True"/>
|
||||
<DiscreteBooleanKeyFrame KeyTime="00:00:02" Value="False"/>
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="74"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="26"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="106"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="151"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="popup" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.47"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="0.685"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<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.515"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</Window.Resources>
|
||||
<Window.Triggers>
|
||||
<EventTrigger RoutedEvent="tb:TaskbarIcon.TaskbarIconLeftMouseUp" SourceName="tb">
|
||||
<BeginStoryboard Storyboard="{StaticResource OnTaskbarIconLeftMouseUp1}"/>
|
||||
</EventTrigger>
|
||||
</Window.Triggers>
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
Title="Window1"
|
||||
Height="808"
|
||||
Width="769"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:local="clr-namespace:Sample_Project">
|
||||
<Window.Resources>
|
||||
|
||||
<Border
|
||||
x:Key="yb"
|
||||
Background="Yellow">
|
||||
<Button
|
||||
Width="200"
|
||||
Height="200"
|
||||
Content="CONTENT" />
|
||||
</Border>
|
||||
<BooleanToVisibilityConverter
|
||||
x:Key="BooleanToVisibilityConverter" />
|
||||
|
||||
<ToolTip x:Key="borderToolTip">
|
||||
<Border
|
||||
Background="Red"
|
||||
Opacity="0.75">
|
||||
<TextBlock
|
||||
Text="hello world" />
|
||||
</Border>
|
||||
</ToolTip>
|
||||
</Grid.Resources>
|
||||
<tb:TaskbarIcon
|
||||
x:Name="tb"
|
||||
ToolTip="{StaticResource yb}" Height="23" VerticalAlignment="Top"
|
||||
>
|
||||
<ObjectDataProvider
|
||||
MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}"
|
||||
x:Key="ActivationModes">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type
|
||||
TypeName="tb:PopupActivationMode" />
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<tb:TaskbarIcon.TaskbarIconPopup>
|
||||
<Popup StaysOpen="False">
|
||||
<Border
|
||||
Width="200"
|
||||
Height="200"
|
||||
Background="Orange">
|
||||
<TextBlock
|
||||
Text="POPUP!" />
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
<Storyboard
|
||||
x:Key="OnTaskbarIconLeftMouseUp1">
|
||||
<BooleanAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="popup"
|
||||
Storyboard.TargetProperty="(Popup.IsOpen)">
|
||||
<DiscreteBooleanKeyFrame
|
||||
KeyTime="00:00:00"
|
||||
Value="True" />
|
||||
<DiscreteBooleanKeyFrame
|
||||
KeyTime="00:00:02"
|
||||
Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="ellipse"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:00"
|
||||
Value="0" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:01"
|
||||
Value="74" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:01.5000000"
|
||||
Value="26" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:02"
|
||||
Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="ellipse"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:00"
|
||||
Value="0" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:01"
|
||||
Value="106" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:01.5000000"
|
||||
Value="151" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:02"
|
||||
Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="popup"
|
||||
Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:00"
|
||||
Value="0.1" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:02"
|
||||
Value="1" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="ellipse"
|
||||
Storyboard.TargetProperty="(UIElement.Opacity)">
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:00"
|
||||
Value="0.47" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:01"
|
||||
Value="1" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:01.5000000"
|
||||
Value="1" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeyTime="00:00:02"
|
||||
Value="0.685" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<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.515" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</Window.Resources>
|
||||
<Window.Triggers>
|
||||
<EventTrigger
|
||||
RoutedEvent="tb:TaskbarIcon.TaskbarIconLeftMouseUp"
|
||||
SourceName="tb">
|
||||
<BeginStoryboard
|
||||
Storyboard="{StaticResource OnTaskbarIconLeftMouseUp1}" />
|
||||
</EventTrigger>
|
||||
</Window.Triggers>
|
||||
<Grid>
|
||||
<tb:TaskbarIcon
|
||||
x:Name="tb"
|
||||
VerticalAlignment="Top"
|
||||
IconSource="{Binding Path=SelectedItem.Source, ElementName=iconList, Mode=Default}"
|
||||
ContextMenu="{DynamicResource tbMenu}"
|
||||
ToolTip="hello world"
|
||||
ToolTipText="{Binding Path=Text, ElementName=txtToolTipText, Mode=Default}"
|
||||
Visibility="{Binding Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=iconVisibility, Mode=Default}"
|
||||
MenuActivation="{Binding Path=SelectedItem, ElementName=lstMenuTrigger, Mode=Default}"
|
||||
PopupActivation="{Binding Path=SelectedItem, ElementName=lstPopupTrigger, Mode=Default}">
|
||||
|
||||
<tb:TaskbarIcon.TaskbarIconPopup>
|
||||
<local:FancyPopup />
|
||||
</tb:TaskbarIcon.TaskbarIconPopup>
|
||||
|
||||
<tb:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem
|
||||
Header="Open" />
|
||||
<MenuItem
|
||||
Header="Quite" />
|
||||
</ContextMenu>
|
||||
</tb:TaskbarIcon.ContextMenu>
|
||||
|
||||
|
||||
<!-- <tb:TaskbarIcon.ToolTip>-->
|
||||
<!-- <Border Background="Yellow">-->
|
||||
<!-- <TextBlock-->
|
||||
<!-- Text="PopupToolTip" />-->
|
||||
<!-- </Border>-->
|
||||
<!-- </tb:TaskbarIcon.ToolTip>-->
|
||||
</tb:TaskbarIcon>
|
||||
|
||||
<tb:TaskbarIcon.TaskbarIconToolTip>
|
||||
<!-- the control will be put into a tooltip with an explicit DataContext -->
|
||||
<local:FancyToolTip
|
||||
Opacity="0.85"
|
||||
InfoText="{Binding Path=ToolTipText}" />
|
||||
</tb:TaskbarIcon.TaskbarIconToolTip>
|
||||
|
||||
</tb:TaskbarIcon>
|
||||
|
||||
<Button
|
||||
x:Name="btn"
|
||||
Click="OnClick"
|
||||
Content="Click me"
|
||||
Height="24"
|
||||
Margin="12,33,66,0"
|
||||
VerticalAlignment="Top" />
|
||||
Margin="0,70,68,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="73"
|
||||
HorizontalAlignment="Right" />
|
||||
<Button
|
||||
Height="23"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,91,64,0"
|
||||
Name="button1"
|
||||
Margin="0,116,66,0"
|
||||
x:Name="button1"
|
||||
VerticalAlignment="Top"
|
||||
Width="75">Button</Button>
|
||||
<TextBox
|
||||
Text="{Binding ElementName=tb, Path=ToolTipText}"
|
||||
Height="23"
|
||||
Margin="13,91,0,0"
|
||||
Name="textBox1"
|
||||
Width="75"
|
||||
Content="Button" />
|
||||
<Popup
|
||||
x:Name="popup"
|
||||
Margin="-231,-276,231,0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"
|
||||
Width="120" />
|
||||
<Popup x:Name="popup">
|
||||
<Grid Width="180" Height="227">
|
||||
<Border CornerRadius="10,10,10,10" x:Name="border">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#FFF4B569" Offset="0"/>
|
||||
<GradientStop Color="#FFFFFFFF" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Ellipse Fill="#FFC13E3E" Stroke="#FF000000" VerticalAlignment="Top" Height="58" Margin="51,19,75,0" x:Name="ellipse" 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>
|
||||
</Grid>
|
||||
Height="549"
|
||||
d:IsHidden="True"
|
||||
d:IsLocked="True">
|
||||
<Grid
|
||||
Width="180"
|
||||
Height="227">
|
||||
<Border
|
||||
CornerRadius="10,10,10,10"
|
||||
x:Name="border">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop
|
||||
Color="#FFF4B569"
|
||||
Offset="0" />
|
||||
<GradientStop
|
||||
Color="#FFFFFFFF"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Ellipse
|
||||
Fill="#FFC13E3E"
|
||||
Stroke="#FF000000"
|
||||
VerticalAlignment="Top"
|
||||
Height="58"
|
||||
Margin="51,19,75,0"
|
||||
x:Name="ellipse"
|
||||
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>
|
||||
</Grid>
|
||||
</Popup>
|
||||
<CheckBox
|
||||
HorizontalAlignment="Left"
|
||||
Margin="8,116,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="155.42"
|
||||
Content="Taskbar Icon Visible"
|
||||
x:Name="iconVisibility"
|
||||
IsChecked="True" />
|
||||
<ListBox
|
||||
HorizontalAlignment="Left"
|
||||
Margin="8,171,0,0"
|
||||
Width="123"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
Height="51"
|
||||
VerticalAlignment="Top"
|
||||
x:Name="iconList"
|
||||
SelectedIndex="0">
|
||||
<Image
|
||||
Width="16"
|
||||
Margin="0,4,0,0"
|
||||
Height="16"
|
||||
Source="Icons\Inactive.ico" />
|
||||
<Image
|
||||
Width="16"
|
||||
Margin="0,4,0,0"
|
||||
Height="16"
|
||||
Source="Icons\Error.ico" />
|
||||
|
||||
</ListBox>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
Margin="8,149,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="Auto"
|
||||
Height="22"
|
||||
TextWrapping="Wrap"><Run
|
||||
Text="Taskbar Icon:"
|
||||
Language="de-ch" /></TextBlock>
|
||||
<Grid
|
||||
Margin="0,0,10,24"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="242"
|
||||
Width="358"
|
||||
HorizontalAlignment="Right"
|
||||
x:Name="Balloons">
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
BorderBrush="#FF000000"
|
||||
BorderThickness="2,2,2,2" />
|
||||
<TextBox
|
||||
Margin="127,20,15,0"
|
||||
x:Name="txtBalloonTitle"
|
||||
VerticalAlignment="Top"
|
||||
Height="23" />
|
||||
<TextBox
|
||||
Margin="127,65,15,97"
|
||||
x:Name="txtBalloonText" />
|
||||
<RadioButton
|
||||
HorizontalAlignment="Left"
|
||||
Margin="14,0,0,54"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="111"
|
||||
Height="22"
|
||||
Content="Show as Info"
|
||||
IsChecked="True" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
Margin="14,20,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="85"
|
||||
Height="23"
|
||||
TextWrapping="Wrap"><Run
|
||||
Text="Balloon Title"
|
||||
Language="de-ch" /></TextBlock>
|
||||
<TextBlock
|
||||
Margin="14,65,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="23"
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Left"
|
||||
Width="85"><Run
|
||||
Text="Balloon Text"
|
||||
Language="de-ch" /></TextBlock>
|
||||
<RadioButton
|
||||
Margin="14,0,0,32"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="22"
|
||||
Content="Show as Error"
|
||||
HorizontalAlignment="Left"
|
||||
Width="111" />
|
||||
<RadioButton
|
||||
Margin="14,0,0,10"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="22"
|
||||
Content="Show Custom Icon"
|
||||
HorizontalAlignment="Left"
|
||||
Width="130" />
|
||||
<Button
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,21,12.52"
|
||||
x:Name="showBalloonTip"
|
||||
Width="120"
|
||||
Content="Show Balloon Tip"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="23" />
|
||||
</Grid>
|
||||
<Grid
|
||||
HorizontalAlignment="Left"
|
||||
Margin="12,0,0,24"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="307"
|
||||
Height="242"
|
||||
x:Name="Popups">
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
BorderBrush="#FF000000"
|
||||
BorderThickness="2,2,2,2" />
|
||||
<ListBox
|
||||
IsSynchronizedWithCurrentItem="False"
|
||||
x:Name="lstPopupTrigger"
|
||||
ItemsSource="{Binding Mode=OneWay, Source={StaticResource ActivationModes}}"
|
||||
Margin="14,115,97,10"
|
||||
SelectedIndex="0" />
|
||||
<RadioButton
|
||||
HorizontalAlignment="Left"
|
||||
Margin="14,19,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Width="Auto"
|
||||
Height="22"
|
||||
Content="Use simple Popup"
|
||||
IsChecked="True" />
|
||||
<RadioButton
|
||||
Margin="14,41,97,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="22"
|
||||
Content="Use Popup with Storyboard" />
|
||||
<TextBlock
|
||||
Margin="14,83,106,0"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Top"
|
||||
Height="22"><Run
|
||||
Text="Display Popup on:"
|
||||
Language="de-ch" /></TextBlock>
|
||||
</Grid>
|
||||
<Grid
|
||||
Margin="0,323,10,276"
|
||||
Width="358"
|
||||
HorizontalAlignment="Right"
|
||||
x:Name="ToolTips">
|
||||
<Border
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
BorderBrush="#FF000000"
|
||||
BorderThickness="2,2,2,2" />
|
||||
<RadioButton
|
||||
Margin="14,38,10,42"
|
||||
Content="Use custom ToolTip on MouseOver (Vista and above)" />
|
||||
<RadioButton
|
||||
Margin="14,60,97,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="22"
|
||||
Content="Use custom ToolTip with Storyboard" />
|
||||
<RadioButton
|
||||
Margin="14,16,10,0"
|
||||
Content="Only use ToolTipText (no custom tooltip)"
|
||||
VerticalAlignment="Top"
|
||||
Height="22"
|
||||
IsChecked="True" />
|
||||
<TextBox
|
||||
Margin="14,0,21,19"
|
||||
x:Name="txtToolTipText"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="23"
|
||||
Text="Click to open tooltip" />
|
||||
<TextBlock
|
||||
Margin="14,0,157,52"
|
||||
VerticalAlignment="Bottom"
|
||||
Height="16"
|
||||
TextWrapping="Wrap"><Run
|
||||
Text="ToolTip Text:"
|
||||
Language="de-ch" /></TextBlock>
|
||||
</Grid>
|
||||
<Grid
|
||||
HorizontalAlignment="Left"
|
||||
Margin="12,323,0,276"
|
||||
Width="307"
|
||||
x:Name="ContextMenus">
|
||||
<Border
|
||||
BorderBrush="#FF000000"
|
||||
BorderThickness="2,2,2,2" />
|
||||
<ListBox
|
||||
Margin="10,0,128,10"
|
||||
IsSynchronizedWithCurrentItem="False"
|
||||
x:Name="lstMenuTrigger"
|
||||
ItemsSource="{Binding Mode=OneWay, Source={StaticResource ActivationModes}}"
|
||||
Height="124"
|
||||
VerticalAlignment="Bottom"
|
||||
SelectedIndex="1" />
|
||||
<TextBlock
|
||||
Margin="10,10,110,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="22"
|
||||
TextWrapping="Wrap"><Run
|
||||
Text="Trigger Context Menu:"
|
||||
Language="de-ch" /></TextBlock>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Margin="10,10,45,0"
|
||||
VerticalAlignment="Top"
|
||||
Height="Auto"
|
||||
TextWrapping="Wrap"
|
||||
FontWeight="Bold"
|
||||
FontSize="14"><Run
|
||||
Text="This window only contains the plumbing. In order to keep things separated, I created a few user controls for the popups and the TaskbarIcon instance."
|
||||
Language="de-ch" /></TextBlock>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -19,13 +20,11 @@ namespace Sample_Project
|
||||
/// </summary>
|
||||
public partial class Window1 : Window
|
||||
{
|
||||
|
||||
|
||||
public Window1()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//set icon in code - setting the IconSource in XAML
|
||||
//works just fine but breaks the VS designer
|
||||
tb.Icon = Properties.Resources.Computers;
|
||||
}
|
||||
|
||||
private void OnClick(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user