-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
225 lines (209 loc) · 13 KB
/
Copy pathMainWindow.xaml
File metadata and controls
225 lines (209 loc) · 13 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
<Window x:Class="Task_Manager.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"
mc:Ignorable="d"
xmlns:local="clr-namespace:Task_Manager"
Title="Task Manager" Height="911" Width="399" ResizeMode="NoResize" SizeToContent="Height"
Background="DarkGray" WindowStyle="ToolWindow">
<Window.Resources>
<local:DueDateHighlight x:Key="dateConverter"/>
<!-- Template for Diplaying Task in the List Box -->
<DataTemplate x:Key="TaskItemTemplate">
<Border BorderThickness="1" CornerRadius="2" BorderBrush="#8c8d8f"
HorizontalAlignment="Center"
Width="341" MinHeight="50" MaxHeight="200" Margin="0,1">
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="{Binding DueDate, Converter={StaticResource dateConverter}}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsComplete}" Value="True">
<Setter Property="Background" Value="Green"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Expander Grid.Row="2">
<Expander.Header>
<!-- Displays TaskName, DueDate and completed checkbox -->
<Grid Width="311" Height="50" HorizontalAlignment="Center" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<CheckBox Name="TaskComplete" Margin="2" IsChecked="{Binding Path=IsComplete, Mode=TwoWay}" Content="{Binding Path=TaskName}"
Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center"
RenderTransformOrigin="-0.062,0.6" FontSize="20" Foreground="White"
Click="TaskComplete_Click"/>
<Button x:Name="DeleteTask" Background="Transparent" Click="DeleteTask_Click" Content="X"
Width="27" Height="20" Grid.Column="1" BorderThickness="0" FontSize="16" FontWeight="Bold" HorizontalAlignment="Right" VerticalAlignment="Center" FontStyle="Oblique" RenderTransformOrigin="-1.5,0.85" Margin="0,2,2,3"/>
<TextBlock Margin="2" Foreground="#f5f7f2" Text="{Binding Path=DueDate}" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" Cursor="Arrow"/>
</Grid>
</Expander.Header>
<!-- 'Drawer' contains Notes and Edit Button -->
<StackPanel Margin="2">
<DockPanel Height="140">
<TextBlock Height="200" Text="{Binding Path=TaskNotes}" IsEnabled="True"/>
<Button x:Name="TaskEdit" Content="Edit" Width="80" Height="30"
HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="TaskEdit_Click" />
</DockPanel>
</StackPanel>
</Expander>
</Border>
</DataTemplate>
</Window.Resources>
<!-- Main Window -->
<Grid Margin="10,0,4,0" >
<Grid.RowDefinitions>
<RowDefinition Height="50*"/>
<RowDefinition Height="391*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110*"/>
<ColumnDefinition Width="170*"/>
<ColumnDefinition Width="110*"/>
</Grid.ColumnDefinitions>
<!-- Time and Date Display -->
<TextBlock x:Name="Date" TextAlignment="Center" HorizontalAlignment="Center" Margin="3,10,3,0" TextWrapping="Wrap" Grid.ColumnSpan="3" Width="373" FontSize="24" Height="35" VerticalAlignment="Top" FontWeight="Bold">
<Run Text="Wednesday, January 23, 1982"/>
</TextBlock>
<TextBlock x:Name="Time" TextAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"
Text="TextBlock" VerticalAlignment="Top" Margin="148,60,12,0" Height="30" Width="112"
FontSize="20" RenderTransformOrigin="0.496,-0.625" Grid.Column="1" Grid.ColumnSpan="2" />
<!-- 'Add New' Button -->
<Button x:Name="CmdNewTask" Margin="0,55,47,0"
Click="NewTask_Click" RenderTransformOrigin="0.509,-0.667" FontSize="36" FontWeight="Bold" Height="35" VerticalAlignment="Top" HorizontalAlignment="Right" Width="36">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse Stroke="Black"
StrokeThickness="0">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Offset="0"
Color="Silver" />
<GradientStop Offset="0"
Color="DarkGray" />
<GradientStop Offset="3"
Color="Black" />
<RadialGradientBrush.Transform>
<TransformGroup>
<ScaleTransform ScaleY="1" />
</TransformGroup>
</RadialGradientBrush.Transform>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Button.Template>
<Border BorderBrush="{x:Null}" Height="20">
<TextBlock Text="+" VerticalAlignment="Center" Margin="0,-18,0,-14" Height="52">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Blue"/> <!-- May have to make a mouse-event handler to get ListBox.SelectedItem -->
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
</Button>
<!-- Task Item List -->
<ListBox x:Name="TaskListBox" HorizontalAlignment="Center" Height="745" Margin="3,10,9,0" VerticalAlignment="Top"
Width="367" ScrollViewer.VerticalScrollBarVisibility="Hidden" Grid.ColumnSpan="3"
DataContext="{Binding}"
ItemTemplate="{StaticResource TaskItemTemplate}"
BorderThickness="0"
Background="Transparent" Grid.Row="1"
SelectedValuePath="ID">
<ListBox.Resources>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="IsSelected" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.Resources>
</ListBox>
<!-- Add New Task Screen -->
<Grid x:Name="NewTaskOverLay" Panel.ZIndex="1" Visibility="Collapsed" Grid.ColumnSpan="3" Grid.RowSpan="2" Margin="-10,0,-11,0" HorizontalAlignment="Right" Width="400">
<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.5" />
</Grid.Background>
<Grid Background="White" HorizontalAlignment="Center" Height="440" Margin="25,110,35,332" VerticalAlignment="Center" Width="340" RenderTransformOrigin="0.5,0.5" >
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="50"/>
<RowDefinition Height="27*"/>
<RowDefinition Height="7*"/>
</Grid.RowDefinitions>
<Grid.Effect>
<DropShadowEffect/>
</Grid.Effect>
<Label Margin="22,12,240,10" Content="Task Name"/>
<TextBox x:Name="NewTaskName" Margin="105,16,35,10"/>
<Label Margin="22,12,240,10" Content="Due Date" Grid.Row="1"/>
<DatePicker Name="NewDueDate" HorizontalAlignment="Left" Margin="105,13,0,10" Grid.Row="1" Width="200"/>
<Label Margin="22,10,240,227" Content="Details" Grid.Row="2" RenderTransformOrigin="1.611,0.455"/>
<TextBox x:Name="NewTaskNotes" Background="Wheat" Padding="10"
HorizontalAlignment="Left" Margin="22,48,0,10" Grid.Row="2" TextWrapping="Wrap"
Text="Enter Details" Width="295" Cursor="IBeam" IsEnabled="True" SpellCheck.IsEnabled="True"
AcceptsTab="True" AcceptsReturn="True"
/>
<Button x:Name="cmdCloseAdd" Click="CmdCloseAdd_Click" Content="Close"
HorizontalAlignment="Left" Margin="50,25,0,0" Grid.Row="3" VerticalAlignment="Top"
Width="75" Height="20"/>
<Button x:Name="cmdSaveNew" Click="CmdSaveNew_Click" Content="Save" HorizontalAlignment="Left"
Margin="210,25,0,0" Grid.Row="3" VerticalAlignment="Top" Width="75" Height="20"/>
</Grid>
</Grid>
<!-- Edit Task Screen -->
<Grid x:Name="EditTaskOverLay" Panel.ZIndex="1" Visibility="Collapsed" Grid.ColumnSpan="3" Grid.RowSpan="2" Margin="-10,0,-11,0" HorizontalAlignment="Right" Width="400">
<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.5" />
</Grid.Background>
<Grid Background="White" HorizontalAlignment="Center" Height="440" Margin="25,110,35,332"
VerticalAlignment="Center" Width="340" RenderTransformOrigin="0.5,0.5">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="50"/>
<RowDefinition Height="27*"/>
<RowDefinition Height="7*"/>
</Grid.RowDefinitions>
<Grid.Effect>
<DropShadowEffect/>
</Grid.Effect>
<Label Margin="22,12,240,10" Content="Task Name"/>
<TextBox x:Name="UpdateTaskName" Margin="105,16,35,10" />
<Label Margin="22,12,240,10" Content="Due Date" Grid.Row="1"/>
<DatePicker Name="UpdateDueDate" HorizontalAlignment="Left" Margin="105,13,0,10" Grid.Row="1" Width="200"/>
<Label Margin="22,10,240,227" Content="Details" Grid.Row="2" RenderTransformOrigin="1.611,0.455"/>
<TextBox x:Name="UpdateTaskNotes" Background="Wheat" Padding="10"
HorizontalAlignment="Left" Margin="22,48,0,10" Grid.Row="2" TextWrapping="Wrap"
Text="Enter Details" Width="295" Cursor="IBeam" IsEnabled="True" SpellCheck.IsEnabled="True"
AcceptsTab="True" AcceptsReturn="True"
/>
<Button x:Name="cmdCloseUpdate" Click="CloseUpdate_Click" Content="Close"
HorizontalAlignment="Left" Margin="50,25,0,0" Grid.Row="3" VerticalAlignment="Top"
Width="75" Height="20"/>
<Button x:Name="cmdUpdate" Click="Update_Click" Content="Save" HorizontalAlignment="Left"
Margin="210,25,0,0" Grid.Row="3" VerticalAlignment="Top" Width="75" Height="20"/>
</Grid>
</Grid>
</Grid>
</Window>