-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
257 lines (238 loc) · 15.4 KB
/
MainWindow.xaml
File metadata and controls
257 lines (238 loc) · 15.4 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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<Window x:Name="AppWindow" x:Class="Goal_Tracker.MainWindow"
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:local="clr-namespace:Goal_Tracker"
mc:Ignorable="d"
Title="Goal Tracker" Height="600" Width="800"
MinHeight="600" MinWidth="800"
Loaded="Window_Loaded">
<Window.Resources>
<!-- Define Color Resources for Difficulty Levels -->
<Color x:Key="VeryEasyColor">#40d0c0</Color>
<Color x:Key="EasyColor">#40d080</Color>
<Color x:Key="NormalColor">#40d020</Color>
<Color x:Key="HardColor">#f8d000</Color>
<Color x:Key="ToughColor">#f04028</Color>
<Color x:Key="InsaneColor">#e048f0</Color>
<Color x:Key="ExtremeColor">#8000a0</Color>
<Color x:Key="ExtremeTier2Color">#780050</Color>
<Color x:Key="ExtremeTier3Color">#70001b</Color>
<Color x:Key="ImpossibleColor">#000000</Color>
<!-- Define Color Brushes for Background -->
<SolidColorBrush x:Key="VeryEasyBrush" Color="{StaticResource VeryEasyColor}" />
<SolidColorBrush x:Key="EasyBrush" Color="{StaticResource EasyColor}" />
<SolidColorBrush x:Key="NormalBrush" Color="{StaticResource NormalColor}" />
<SolidColorBrush x:Key="HardBrush" Color="{StaticResource HardColor}" />
<SolidColorBrush x:Key="ToughBrush" Color="{StaticResource ToughColor}" />
<SolidColorBrush x:Key="InsaneBrush" Color="{StaticResource InsaneColor}" />
<SolidColorBrush x:Key="ExtremeBrush" Color="{StaticResource ExtremeColor}" />
<SolidColorBrush x:Key="ExtremeTier2Brush" Color="{StaticResource ExtremeTier2Color}" />
<SolidColorBrush x:Key="ExtremeTier3Brush" Color="{StaticResource ExtremeTier3Color}" />
<SolidColorBrush x:Key="ImpossibleBrush" Color="{StaticResource ImpossibleColor}" />
<SolidColorBrush x:Key="ToughBorderBrush" Color="#f02800" />
<SolidColorBrush x:Key="ImpossibleBorderBrush" Color="#D35D6E" />
<!-- Default DataTemplate for Goal Item -->
<DataTemplate x:Key="GoalItemTemplate">
<Border x:Name="GoalBorder" CornerRadius="10" Margin="10" Padding="10"
BorderBrush="{Binding DifficultyBorderColor}" BorderThickness="3"
Background="{Binding FillDifficultyColor}" MouseLeftButtonUp="Goal_Click">
<!-- Grid to layout goal info and checkbox -->
<Grid x:Name="GoalGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<!-- for the goal details -->
<ColumnDefinition Width="Auto" />
<!-- for the checkbox -->
</Grid.ColumnDefinitions>
<!-- Goal Name and Description in the first column -->
<StackPanel Grid.Column="0">
<!-- Name TextBlock with Strikethrough -->
<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="16" Foreground="{Binding TextColor}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="TextDecorations" Value="{x:Null}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsCompleted}" Value="True">
<Setter Property="TextDecorations" Value="Strikethrough" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- Description TextBlock with Strikethrough -->
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" FontSize="14" Margin="0,5,0,0" Foreground="{Binding TextColor}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="TextDecorations" Value="{x:Null}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsCompleted}" Value="True">
<Setter Property="TextDecorations" Value="Strikethrough" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- Difficulty and Points Section -->
<Grid Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<!-- Difficulty Number -->
<ColumnDefinition Width="Auto" />
<!-- Difficulty Category -->
<ColumnDefinition Width="*" />
<!-- Points Available -->
</Grid.ColumnDefinitions>
<!-- Difficulty Number -->
<TextBlock Grid.Column="0" Text="{Binding Difficulty}" FontSize="20" FontWeight="Bold" Width="25" Height="30"
TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="{Binding TextColor}" Margin="0,2,5,0" />
<!-- Difficulty Category -->
<TextBlock Grid.Column="1" Text="{Binding DifficultyCategory}" FontStyle="Italic" FontSize="12"
VerticalAlignment="Center" Foreground="{Binding TextColor}" Margin="0,2,5,0" />
<!-- Points Available Section -->
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<!-- Points Number -->
<TextBlock Text="0" Visibility="Hidden" FontSize="18" FontWeight="Bold"
Foreground="{Binding TextColor}" Margin="0,0,5,0" />
<!-- "pts" Text -->
<TextBlock Text="pts" Visibility="Hidden" FontStyle="Italic" FontSize="12"
Foreground="{Binding TextColor}" Margin="2,4,0,0" />
</StackPanel>
</Grid>
</StackPanel>
<!-- Complete Goal Checkbox in the second column -->
<CheckBox Grid.Column="1" IsChecked="{Binding IsCompleted}" HorizontalAlignment="Right"
VerticalAlignment="Center" Checked="GoalCompleted_Checked" Visibility="Visible" Margin="10,0,10,0">
<CheckBox.LayoutTransform>
<ScaleTransform ScaleX="4" ScaleY="4" />
</CheckBox.LayoutTransform>
</CheckBox>
<!-- Completion Date -->
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="{Binding TextColor}"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="-4">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsCompleted}" Value="True">
<Setter Property="Visibility" Value="Visible" />
<Setter Property="Text" Value="{Binding CompletionDate, StringFormat='Completed: {0:g}'}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Border>
</DataTemplate>
<!-- Alternative DataTemplate for Squared, Thicker, Left-Aligned Border -->
<DataTemplate x:Key="CompactGoalItemTemplate">
<Border x:Name="GoalBorder" CornerRadius="0" Margin="10" Padding="0"
Background="{Binding FillDifficultyColor}" MouseLeftButtonUp="Goal_Click">
<!-- Grid to layout goal info and checkbox -->
<Grid x:Name="GoalGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5" />
<!-- Custom vertical bar (left border) -->
<ColumnDefinition Width="*" />
<!-- Goal info column -->
<ColumnDefinition Width="Auto" />
<!-- Checkbox column -->
</Grid.ColumnDefinitions>
<!-- Left Vertical Bar (Border Color) -->
<Rectangle Grid.Column="0" Fill="{Binding DifficultyBorderColor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<!-- Goal Content Column (background fill) -->
<Grid Grid.Column="1" Background="{Binding FillDifficultyColor}" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<!-- Content row (goal name, description, etc.) -->
<RowDefinition Height="Auto" />
<!-- Completion date row -->
</Grid.RowDefinitions>
<!-- Goal Content (Name, Description, Difficulty) -->
<StackPanel Grid.Row="0" Margin="10,8,8,8">
<!-- Reduced margin to compact layout -->
<!-- Goal Name -->
<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="16" Foreground="{Binding TextColor}" TextWrapping="Wrap">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="TextDecorations" Value="{x:Null}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsCompleted}" Value="True">
<Setter Property="TextDecorations" Value="Strikethrough" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- Goal Description -->
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" FontSize="14" Margin="0,5,0,0" Foreground="{Binding TextColor}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="TextDecorations" Value="{x:Null}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsCompleted}" Value="True">
<Setter Property="TextDecorations" Value="Strikethrough" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- Difficulty Section -->
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock Text="{Binding Difficulty}" FontSize="20" FontWeight="Bold" Width="30" Height="30"
TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="{Binding TextColor}" Margin="0,2,5,0" />
<TextBlock Text="{Binding DifficultyCategory}" FontStyle="Italic" FontSize="12"
VerticalAlignment="Center" Foreground="{Binding TextColor}" Margin="0,2,0,0" />
</StackPanel>
</StackPanel>
<!-- Completion Date (Visible when completed) -->
<TextBlock Grid.Row="1" FontSize="12" Foreground="{Binding TextColor}"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,5,10,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsCompleted}" Value="True">
<Setter Property="Visibility" Value="Visible" />
<Setter Property="Text" Value="{Binding CompletionDate, StringFormat='Completed: {0:g}'}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<!-- Checkbox (Complete Goal) -->
<CheckBox Grid.Column="2" IsChecked="{Binding IsCompleted}" HorizontalAlignment="Right"
VerticalAlignment="Center" Checked="GoalCompleted_Checked" Visibility="Visible"
Margin="20,5" VerticalContentAlignment="Center">
<CheckBox.LayoutTransform>
<ScaleTransform ScaleX="4" ScaleY="4" />
</CheckBox.LayoutTransform>
</CheckBox>
</Grid>
</Border>
</DataTemplate>
</Window.Resources>
<Grid x:Name="AppGrid" Background="#f5f5f5">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<ItemsControl Name="GoalsList" Margin="10" ItemTemplate="{StaticResource GoalItemTemplate}">
</ItemsControl>
</ScrollViewer>
<!-- Context Menu Section -->
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Add Goal to Top" Click="AddGoalToTop_Click"/>
<MenuItem Header="Add Goal to Bottom" Click="AddGoalToBottom_Click"/>
<Separator />
<MenuItem x:Name="FilterA" Header="Show Completed Goals" Click="FilterA_Click"/>
<MenuItem x:Name="FilterB" Header="Show All Goals" Click="FilterB_Click"/>
<Separator />
<MenuItem Header="Options" Click="OptionsMenu_Click"/>
</ContextMenu>
</Grid.ContextMenu>
</Grid>
</Window>