-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
159 lines (152 loc) · 11.2 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<Window x:Class="PMTaskbar.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=System.Private.CoreLib"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PMTaskbar"
mc:Ignorable="d"
x:Name="me"
Title="" Height="480" Width="60" WindowStyle="ToolWindow" ResizeMode="NoResize" Topmost="True">
<Window.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="DimGray"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ButtonBase">
<Border BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" CornerRadius="2" Background="{TemplateBinding Panel.Background}" Name="border" SnapsToDevicePixels="True">
<ContentPresenter RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" Name="contentPresenter" Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" Focusable="False" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsDefaulted" Value="True">
<Setter Property="Border.BorderBrush" TargetName="border" Value="Gray"/>
<!--<Setter.Value><DynamicResource ResourceKey="{x:Static SystemColors.HighlightBrushKey}" /></Setter.Value>-->
</Trigger>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Panel.Background" TargetName="border" Value="Gray"/>
<Setter Property="Border.BorderBrush" TargetName="border" Value="Gray"/>
</Trigger>
<Trigger Property="ButtonBase.IsPressed" Value="True">
<Setter Property="Panel.Background" TargetName="border" Value="Gray"/>
<Setter Property="Border.BorderBrush" TargetName="border" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListView x:Name="lst" ItemsSource="{Binding Items}" AllowDrop="True" Background="#1d2951" Drop="ListView_Drop" Grid.Row="0" BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
MouseDoubleClick="lst_MouseDoubleClick" SelectionMode="Single">
<ListView.ContextMenu>
<ContextMenu>
<ContextMenu.Style>
<Style TargetType="{x:Type ContextMenu}">
<Setter Property="Background" Value="DimGray"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Border BorderThickness="1" CornerRadius="4" BorderBrush="Black" x:Name="Border" Background="DimGray">
<StackPanel ClipToBounds="True" Orientation="Vertical" IsItemsHost="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="DimGray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ContextMenu.Style>
<MenuItem Header="Unpin" Click="UnpinMenuItem_Click" IsCheckable="False" Height="32"></MenuItem>
</ContextMenu>
</ListView.ContextMenu>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="AllowDrop" Value="True"/>
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListView_MouseDown" />
<EventSetter Event="Drop" Handler="ListItem_Drop" />
<EventSetter Event="MouseEnter" Handler="ListViewItem_MouseEnter" />
<EventSetter Event="MouseLeave" Handler="ListViewItem_MouseLeave" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center">
<Image Source="{Binding IconImg}" Margin="2,4" />
<Popup PlacementTarget="{Binding .}" Placement="{Binding PopupPlacement,ElementName=me}" IsOpen="{Binding IsPopupShow}">
<ListView ItemsSource="{Binding Windows}" SelectionMode="Single" Background="DimGray" BorderThickness="0" BorderBrush="Black" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<Border Background="DimGray" CornerRadius="2,2,0,0" ClipToBounds="False" ToolTip="{Binding Title}">
<Border.Resources>
<Style TargetType="ToolTip" BasedOn="{StaticResource {x:Type ToolTip}}">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#3d3d3d" />
<Setter Property="BorderBrush" Value="White" />
<Setter Property="MaxWidth" Value="50" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<ContentPresenter Content="{TemplateBinding Content}">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Border.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button HorizontalAlignment="Stretch" Click="WindowRestoreButton_Click" Foreground="White" BorderThickness="0">
<Image Source="{Binding ImgSrc}" Margin="5" />
<!--<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} : {1}">
<Binding Path="process.Id" />
<Binding Path="process.ProcessName" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>-->
</Button>
<Button Width="30" Height="30" Click="WindowCloseButton_Click" Grid.Column="1" Margin="2,2,-2,0" VerticalAlignment="Top">
<Path Data="M0,0 L10,10 M10,0 L0,10" Stroke="White" />
</Button>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListView>
</Popup>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="-2,3,-2,0">
<Button Click="UpButton_Click" Padding="5,4" Margin="0" Background="#3d3d3d">
<Path Height="10" Width="10" Data="M 0,10 5,0 10,10 Z" StrokeThickness="0" Fill="White" Margin="0,0,0,1" />
</Button>
<Button Click="DnButton_Click" Padding="5,4" Margin="0" Background="#3d3d3d">
<Path Height="10" Width="10" Data="M 0,0 5,10 10,0 Z" StrokeThickness="0" Fill="White" Margin="0,2,0,0" />
</Button>
</StackPanel>
<local:TaskbarPanel ShowSeconds="{Binding PanelShowSeconds, Mode=TwoWay}" ShowDate="{Binding PanelShowDate, Mode=TwoWay}" Grid.Row="2" VerticalAlignment="Center" Margin="-2,2,-2,4" />
</Grid>
</Window>