<Window x:Class="Wpf_Demo.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			xmlns:dataSource="clr-namespace:Wpf_Demo.ViewModels" 
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		mc:Ignorable="d"
		Title="Ninja Database Pro Demo" Height="600" Width="800" Loaded="Window_Loaded" Closed="Window_Closed">
	<Grid>
		<FrameworkElement.Resources>
			<!-- Creating an instance of the view model-->
			<dataSource:MainViewModel x:Key="MainViewModel" />
		</FrameworkElement.Resources>
		<!--Data context is set to sample data above and LayoutRoot contains the root grid where all other page content is placed-->
		<Grid x:Name="LayoutRoot">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="*"/>
				<RowDefinition Height="100"/>
			</Grid.RowDefinitions>

			<!--TitlePanel contains the name of the application and page title-->
			<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="20,40,20,20">
				<TextBlock x:Name="ApplicationTitle" Text="Bucket List" FontSize="16"/>
				<TextBlock x:Name="ListTitle" Text="To do before I kick the bucket" FontSize="24"/>
			</StackPanel>

			<!--ContentPanel contains ListBox and ListBox ItemTemplate. Place additional content here-->
			<Grid x:Name="ContentPanel" Grid.Row="1" d:DataContext ="{Binding Source={StaticResource MainViewModel}}">
				<ListBox x:Name="MainListBox" ItemsSource="{Binding Items}" 
					 ScrollViewer.HorizontalScrollBarVisibility="Auto" 
					 ScrollViewer.VerticalScrollBarVisibility="Auto"
					 Margin="20,20,20,20" SelectionChanged="MainListBox_SelectionChanged" MouseDoubleClick="MainListBox_MouseDoubleClick">
					<ListBox.ItemTemplate>
						<DataTemplate>
							<StackPanel Orientation="Horizontal" Width="466" Margin="0,0,0,0" >

								<CheckBox x:Name="chkDone" 
									  IsChecked="{Binding Done, Mode=TwoWay}"
									  IsEnabled="True" BorderBrush="Black" Foreground="White" Margin="5,0,0,0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BorderThickness="3" Width="20" Background="#BFFFFFFF"
									  />
								<TextBlock x:Name="txtGoal" Text="{Binding Goal, Mode=OneWay}"
										VerticalAlignment="Center"
										Margin="0,0,0,0" FontSize="16"
									   />
							</StackPanel>
						</DataTemplate>
					</ListBox.ItemTemplate>
				</ListBox>
			</Grid>
			<Grid x:Name="FooterPanel" Grid.Row="2" Grid.Column="0">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="0.35*" />
						<RowDefinition Height="0.40*" />
						<RowDefinition Height="0.25*" />
					</Grid.RowDefinitions>
					<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="0">
						<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="0">
							<TextBlock x:Name="lblTotal" Text="Total:" Margin="0,0,15,0" HorizontalAlignment="Right" FontSize="16" />
							<TextBlock x:Name="lblDollarSign" Text="$" FontSize="16" />
							<TextBlock x:Name="txtTotal" Text ="{Binding TotalCost}" Margin="0,0,15,0" FontSize="16" />
						</StackPanel>
					</StackPanel>
					<StackPanel Orientation="Horizontal" Grid.Row="1">
						<Button x:Name="btnAdd"  Margin="20,0,20,0" Width="80" Height="30" Click="btnAdd_Click" IsDefault="True">Add</Button>
						<Button x:Name="btnDelete" Margin="20,0,20,0" Width="80" Height="30" Click="btnDelete_Click" IsEnabled="False">Delete</Button>
					</StackPanel>
				</Grid>
			</Grid>
		</Grid>
	</Grid>
</Window>
