mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-15 09:45:36 -05:00
-------------- CHG Merged partial classes of TaskbarIcon - no only 2 files. ADD Added attached events that indicate an opened popup/tooltip ADD Added storyboards in samples that make use of attached events. git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@56 9f600761-6f11-4665-b6dc-0185e9171623
300 lines
8.8 KiB
XML
300 lines
8.8 KiB
XML
<Window
|
|
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"
|
|
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>
|
|
|
|
<BooleanToVisibilityConverter
|
|
x:Key="BooleanToVisibilityConverter" />
|
|
|
|
<ObjectDataProvider
|
|
MethodName="GetValues"
|
|
ObjectType="{x:Type sys:Enum}"
|
|
x:Key="ActivationModes">
|
|
<ObjectDataProvider.MethodParameters>
|
|
<x:Type
|
|
TypeName="tb:PopupActivationMode" />
|
|
</ObjectDataProvider.MethodParameters>
|
|
</ObjectDataProvider>
|
|
<Storyboard x:Key="FadeToolTip"/>
|
|
</Window.Resources>
|
|
<Window.Triggers>
|
|
<EventTrigger RoutedEvent="tb:TaskbarIcon.TaskbarIconToolTipOpen" SourceName="tb"/>
|
|
</Window.Triggers>
|
|
|
|
<Grid>
|
|
<tb:TaskbarIcon
|
|
x:Name="tb"
|
|
VerticalAlignment="Top"
|
|
IconSource="{Binding Path=SelectedItem.Source, ElementName=iconList, Mode=Default}"
|
|
ContextMenu="{DynamicResource tbMenu}"
|
|
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>
|
|
<!-- the control will be put into a popup with an explicit DataContext -->
|
|
<local:FancyPopup />
|
|
</tb:TaskbarIcon.TaskbarIconPopup>
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
<!-- EVERYTHING BELOW IS JUST PLUMBING FOR THE SAMPLE -->
|
|
|
|
|
|
|
|
<Button
|
|
x:Name="btn"
|
|
Click="OnClick"
|
|
Content="Click me"
|
|
Height="24"
|
|
Margin="0,70,68,0"
|
|
VerticalAlignment="Top"
|
|
Width="73"
|
|
HorizontalAlignment="Right" />
|
|
<Button
|
|
Height="23"
|
|
HorizontalAlignment="Right"
|
|
Margin="0,116,66,0"
|
|
x:Name="button1"
|
|
VerticalAlignment="Top"
|
|
Width="75"
|
|
Content="Button" />
|
|
<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,95,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="Some Title Goes Here..." Language="de-ch"/></TextBlock>
|
|
</Grid>
|
|
</Window>
|