mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-17 09:45:38 -05:00
WPF NotifyIcon
-------------- FIX Removed debug output in WindowMessageSink. CHG Major rework on sample project. git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@104 9f600761-6f11-4665-b6dc-0185e9171623
This commit is contained in:
155
Source/Sample Project/Showcase/NotifyIconResources.xaml
Normal file
155
Source/Sample Project/Showcase/NotifyIconResources.xaml
Normal file
@@ -0,0 +1,155 @@
|
||||
<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 of simple data binding -->
|
||||
<ContextMenu
|
||||
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 Main Window"
|
||||
Command="{Commands:ShowMainWindowCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Images/Add.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem
|
||||
Header="Hide Main Window"
|
||||
Command="{Commands:HideMainWindowCommand}">
|
||||
<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>
|
||||
Reference in New Issue
Block a user