forked from BornToBeRoot/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotificationWindow.xaml
More file actions
119 lines (114 loc) · 6.02 KB
/
Copy pathNotificationWindow.xaml
File metadata and controls
119 lines (114 loc) · 6.02 KB
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
<mah:MetroWindow x:Class="NETworkManager.NotificationWindow"
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:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
xmlns:networkManager="clr-namespace:NETworkManager"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance networkManager:NotificationWindow}"
Style="{DynamicResource DefaultWindow}"
Topmost="True"
ShowInTaskbar="False"
Width="360"
MinHeight="80"
SizeToContent="Height"
ResizeMode="NoResize"
IsWindowDraggable="False"
ShowTitleBar="False"
ShowMinButton="False"
ShowMaxRestoreButton="False"
ShowCloseButton="False"
Closing="MetroWindow_Closing">
<!-- Clicking anywhere on the popup (except the close button) opens the main window.
Background="Transparent" makes the empty areas hit-test visible. -->
<Grid Background="Transparent" Cursor="Hand"
ToolTip="{x:Static localization:Strings.Show}"
MouseLeftButtonUp="Root_MouseLeftButtonUp">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3" />
</Grid.RowDefinitions>
<!-- Main content -->
<Grid Grid.Row="0" Margin="10" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Status icon: kind and color bound from constructor parameters -->
<Rectangle Grid.Column="0" Grid.Row="0"
Width="32" Height="32"
Fill="{Binding IconColor}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform">
<VisualBrush.Visual>
<iconPacks:PackIconMaterial Kind="{Binding IconKind}" />
</VisualBrush.Visual>
</VisualBrush>
</Rectangle.OpacityMask>
</Rectangle>
<!-- Title + timestamp (header row) + Message (gray subtext) — fully generic -->
<Grid Grid.Column="2" Grid.Row="0" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{Binding NotificationTitle}"
Style="{StaticResource DefaultTextBlock}"
TextTrimming="CharacterEllipsis" />
<TextBlock Grid.Row="0" Grid.Column="1"
Text="{Binding Time}"
Margin="10,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource DefaultTextBlock}"
Foreground="{DynamicResource MahApps.Brushes.Gray5}" />
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
Text="{Binding Message}"
Margin="0,5,0,0"
Style="{StaticResource DefaultTextBlock}"
Foreground="{DynamicResource MahApps.Brushes.Gray5}"
TextWrapping="Wrap" />
</Grid>
<!-- Close [×] — gray, Gray5 on hover, NOT red -->
<Button Grid.Column="4"
Command="{Binding CloseCommand}"
ToolTip="{x:Static localization:Strings.Close}"
Style="{StaticResource CleanButton}"
VerticalAlignment="Top"
Margin="0,2,0,0">
<Rectangle Width="16" Height="16">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Fill" Visual="{iconPacks:Material Kind=WindowClose}" />
</Rectangle.OpacityMask>
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray3}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
<Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray5}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Button>
</Grid>
<!-- Countdown ProgressBar — 3 px, depletes left-to-right -->
<ProgressBar Grid.Row="1"
Minimum="0"
Maximum="{Binding TimeMax, Mode=OneWay}"
Value="{Binding TimeRemaining, Mode=OneWay}"
BorderThickness="0"
Padding="0" />
</Grid>
</mah:MetroWindow>