1 <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3 StartupUri="HomePage.xaml"
4 x:Class="ExpenseIt.App"
5 xmlns:l="clr-namespace:Editing"
6 xmlns:MappingPIGen1="clr-namespace:ExpenseIt"
7 xmlns:localValidation="clr-namespace:ExpenseIt.Validation"
9 <Application.Resources>
10 <ExpenseReport x:Key="ExpenseData"
11 xmlns="clr-namespace:ExpenseIt"
12 Alias="Someone@example.com"
13 EmployeeNumber="57304"
15 <ExpenseReport.LineItems>
17 Description="Mexican Lunch"
20 Description="Italian Dinner"
22 <LineItem Type="Education"
23 Description="Developer Conference"
25 <LineItem Type="Travel"
28 <LineItem Type="Travel"
31 </ExpenseReport.LineItems>
33 <XmlDataProvider x:Key="CostCenters"
34 XPath="/CostCenters/*">
36 <CostCenters xmlns="">
37 <CostCenter Number="4032"
39 <CostCenter Number="4034"
41 <CostCenter Number="5061"
42 Name="Human Resources" />
43 <CostCenter Number="5062"
44 Name="Research and Development" />
48 <XmlDataProvider x:Key="Employees"
52 <Employee Name="Terry Adams"
55 <Employee Name="Claire O'Donnell"
57 EmployeeNumber="12345" />
58 <Employee Name="Palle Peterson"
60 EmployeeNumber="5678" />
61 <Employee Name="Amy E. Alberts"
63 EmployeeNumber="99222" />
64 <Employee Name="Stefan Hesse"
70 <Style x:Key="ButtonInFlow"
71 TargetType="{x:Type Button}">
72 <Setter Property="Margin"
76 TargetType="{x:Type Button}">
77 <Setter Property="Padding"
80 <Style x:Key="EmployeeList"
81 TargetType="{x:Type ListBox}">
82 <Setter Property="Margin"
85 <Style x:Key="HorizontalRadio"
86 TargetType="{x:Type ListBoxItem}">
87 <Setter Property="Margin"
89 <Setter Property="Template">
92 <RadioButton Focusable="false"
93 Content="{TemplateBinding ContentPresenter.Content}"
94 IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" />
99 <Style x:Key="HorizontalRadioList"
100 TargetType="{x:Type ListBox}">
101 <Setter Property="IsTabStop"
103 <Setter Property="Grid.Column"
105 <Setter Property="Grid.Row"
107 <Setter Property="Height"
109 <Setter Property="Margin"
111 <Setter Property="Template">
113 <ControlTemplate TargetType="{x:Type ListBox}">
114 <StackPanel KeyboardNavigation.TabNavigation="Once"
116 Orientation="Horizontal" />
122 <Style x:Key="InputText"
123 TargetType="{x:Type TextBox}">
124 <Setter Property="Height"
126 <Setter Property="FontFamily"
127 Value="Trebuchet MS" />
128 <Setter Property="Foreground"
130 <Setter Property="FontSize"
132 <Setter Property="Margin"
133 Value="10,10,20,10" />
135 <Trigger Property="Validation.HasError" Value="true">
136 <Setter Property="ToolTip"
137 Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
139 <Trigger Property="Validation.HasError" Value="false">
140 <Setter Property="ToolTip"
141 Value="{Binding RelativeSource={RelativeSource Self}, Path=ToolTip.Content}"/>
147 TargetType="{x:Type Label}">
148 <Setter Property="Foreground"
149 Value="DarkSlateBlue" />
150 <Setter Property="FontSize"
152 <Setter Property="FontFamily"
154 <Setter Property="FontWeight"
156 <Setter Property="Margin"
158 <Setter Property="VerticalAlignment"
160 <Setter Property="HorizontalAlignment"
163 <Style x:Key="DisplayText"
164 TargetType="{x:Type TextBlock}">
165 <Setter Property="Foreground"
167 <Setter Property="FontSize"
169 <Setter Property="FontFamily"
171 <Setter Property="FontWeight"
173 <Setter Property="Margin"
175 <Setter Property="HorizontalAlignment"
177 <Setter Property="VerticalAlignment"
180 <Style x:Key="TitleText"
181 TargetType="{x:Type TextBlock}">
182 <Setter Property="FontSize"
184 <Setter Property="Foreground"
186 <Setter Property="FontFamily"
187 Value="Trebuchet MS" />
188 <Setter Property="Margin"
190 <Setter Property="Grid.Row"
192 <Setter Property="Grid.Column"
194 <Setter Property="Grid.ColumnSpan"
196 <Setter Property="FontWeight"
199 <Style x:Key="TableLabel"
200 TargetType="{x:Type TextBlock}">
201 <Setter Property="Foreground"
203 <Setter Property="VerticalAlignment"
205 <Setter Property="HorizontalAlignment"
207 <Setter Property="FontWeight"
209 <Setter Property="FontSize"
212 <Style x:Key="TotalExpenses"
213 TargetType="{x:Type TextBlock}">
214 <Setter Property="FontSize"
216 <Setter Property="Foreground"
218 <Setter Property="Margin"
219 Value="0,10,30,10" />
221 <Style x:Key="TotalExpensesFlow"
222 TargetType="{x:Type StackPanel}">
223 <Setter Property="Orientation"
224 Value="Horizontal" />
225 <Setter Property="HorizontalAlignment"
228 <Style x:Key="TotalExpensesLabel"
229 TargetType="{x:Type TextBlock}">
230 <Setter Property="FontFamily"
231 Value="Trebuchet MS" />
232 <Setter Property="FontSize"
234 <Setter Property="Margin"
235 Value="10,10,0,10" />
236 <Setter Property="Foreground"
239 <Style x:Key="TotalRectangle"
240 TargetType="{x:Type Rectangle}">
241 <Setter Property="Stroke">
243 <LinearGradientBrush StartPoint="0,0"
245 <GradientBrush.GradientStops>
246 <GradientStopCollection>
247 <GradientStop Color="#4E87D4"
249 <GradientStop Color="#73B2F5"
251 </GradientStopCollection>
252 </GradientBrush.GradientStops>
253 </LinearGradientBrush>
256 <Setter Property="StrokeThickness"
258 <Setter Property="Fill">
260 <LinearGradientBrush StartPoint="0,0"
262 <GradientBrush.GradientStops>
263 <GradientStopCollection>
264 <GradientStop Color="#73B2F5"
266 <GradientStop Color="#4E87D4"
268 </GradientStopCollection>
269 </GradientBrush.GradientStops>
270 </LinearGradientBrush>
273 <Setter Property="RadiusX"
275 <Setter Property="RadiusY"
278 <Style x:Key="WatermarkImage"
279 TargetType="{x:Type Image}">
280 <Setter Property="Source"
281 Value="watermark.png" />
282 <Setter Property="HorizontalAlignment"
284 <Setter Property="VerticalAlignment"
286 <Setter Property="Grid.Row"
288 <Setter Property="Grid.RowSpan"
290 <Setter Property="Grid.ColumnSpan"
292 <Setter Property="Width"
294 <Setter Property="Opacity"
297 <DataTemplate x:Key="EmployeeItemTemplate">
298 <TextBlock Text="{Binding XPath=@Name}" />
301 <Style x:Key="ExpenseScroller"
302 TargetType="{x:Type ItemsControl}">
303 <Setter Property="Template">
305 <ControlTemplate TargetType="{x:Type ItemsControl}">
306 <ScrollViewer VerticalScrollBarVisibility="Auto">
307 <StackPanel Orientation="vertical"
308 IsItemsHost="true" />
315 <DataTemplate x:Key="ExpenseTemplate">
317 <Grid.ColumnDefinitions>
318 <ColumnDefinition Width="33*" />
319 <ColumnDefinition Width="33*" />
320 <ColumnDefinition Width="33*" />
321 </Grid.ColumnDefinitions>
322 <TextBox Text="{Binding Path=Type}"
324 <TextBox Text="{Binding Path=Description}"
329 <Binding Path="Cost" UpdateSourceTrigger="PropertyChanged">
330 <!-- SECURITY: Cost must be an int -->
331 <Binding.ValidationRules>
332 <localValidation:NumberValidationRule />
333 </Binding.ValidationRules>
341 <DataTemplate x:Key="CostCenterTemplate">
342 <TextBlock Text="{Binding XPath=@Name}" />
344 <Style x:Key="ExpenseChart"
345 TargetType="{x:Type ItemsControl}">
346 <Setter Property="DataContext"
347 Value="{DynamicResource ExpenseData}" />
348 <Setter Property="ItemsSource"
349 Value="{Binding Path=LineItems}" />
350 <Setter Property="ItemTemplate"
351 Value="{DynamicResource ExpenseChartBar}" />
352 <Setter Property="Template">
354 <ControlTemplate TargetType="{x:Type ItemsControl}">
355 <Grid Width="{TemplateBinding Width}"
356 Height="{TemplateBinding Height}">
357 <Rectangle Stroke="Black"
360 <LinearGradientBrush StartPoint="0,0"
362 <GradientBrush.GradientStops>
363 <GradientStopCollection>
364 <GradientStop Color="RoyalBlue"
366 <GradientStop Color="#99ccff"
368 </GradientStopCollection>
369 </GradientBrush.GradientStops>
370 </LinearGradientBrush>
375 <StackPanel Orientation="Horizontal"
376 IsItemsHost="True" />
383 <DataTemplate x:Key="ExpenseChartBar">
384 <Grid VerticalAlignment="Bottom"
386 <Grid.RowDefinitions>
388 <RowDefinition Height="10" />
389 </Grid.RowDefinitions>
390 <Rectangle Grid.Row="0"
391 Height="{Binding Path=Cost}"
396 <Rectangle.RenderTransform>
397 <TranslateTransform X="1"
399 </Rectangle.RenderTransform>
401 <Rectangle Grid.Row="0"
402 Height="{Binding Path=Cost}"
407 StrokeThickness="0.5">
409 <RadialGradientBrush>
410 <GradientBrush.GradientStops>
411 <GradientStopCollection>
412 <GradientStop Color="LimeGreen"
414 <GradientStop Color="DarkGreen"
416 </GradientStopCollection>
417 </GradientBrush.GradientStops>
418 </RadialGradientBrush>
421 <Rectangle Grid.Row="0"
422 Height="{Binding Path=Cost}"
427 <LinearGradientBrush StartPoint="0,0"
429 <GradientBrush.GradientStops>
430 <GradientStopCollection>
431 <GradientStop Color="#aaffffff"
433 <GradientStop Color="transparent"
435 </GradientStopCollection>
436 </GradientBrush.GradientStops>
437 </LinearGradientBrush>
440 <Viewbox Grid.Row="1"
443 <TextBlock Grid.Row="1"
447 TextAlignment="center"
448 TextTrimming="WordEllipsis"
449 Text="{Binding Path=Description}" />
451 <TextBlock Margin="0,5,0,3"
454 TextAlignment="center"
456 Text="{Binding Path=Cost}" />
459 </Application.Resources>