<Page x:Class="SchoolSample.InstructorPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:di="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Instructor"
d:DesignHeight="480"
d:DesignWidth="640"
Style="{StaticResource PageStyle}"
mc:Ignorable="d">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<cmd:EventToCommand Command="{Binding PageLoadedCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="Unloaded">
<cmd:EventToCommand Command="{Binding PageUnLoadedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid x:Name="LayoutRoot">
<ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">
<StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">
<TextBlock Style="{StaticResource HeaderTextStyle}" Text="{Binding Path=Strings.InstructorPageTitle, Source={StaticResource ApplicationResources}}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.RowSpan="4"
Grid.ColumnSpan="2"
BorderBrush="Black"
BorderThickness="1"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect ShadowDepth="3" />
</Border.Effect>
</Border>
<ListView x:Name="instructorListView"
Grid.Row="0"
Grid.Column="0"
MaxHeight="200"
Margin="10,20"
IsEnabled="{Binding InstructorListIsEnabled}"
ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}"
ItemsSource="{Binding Path=AllInstructorsSource.View}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding PersonId}" Header="Instructor ID" />
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="Name" />
</GridView>
</ListView.View>
</ListView>
<Grid x:Name="instructorGrid"
Grid.Row="0"
Grid.Column="1"
Width="Auto"
MaxHeight="340"
Margin="10,20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90" />
<ColumnDefinition MinWidth="150" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<di:DisplayLabel x:Name="nameLabel"
Grid.Row="0"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=nameTextBox}" />
<DockPanel Grid.Row="0"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="nameDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=nameTextBox}" />
<TextBox x:Name="nameTextBox"
Margin="0,0,5,0"
HorizontalAlignment="Stretch"
DockPanel.Dock="Left"
Text="{Binding Path=CurrentInstructor.Name,
Mode=TwoWay,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}" />
</DockPanel>
<di:DisplayLabel x:Name="hireDateLabel"
Grid.Row="1"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=hireDateDatePicker}" />
<DockPanel Grid.Row="1"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="hireDateDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=hireDateDatePicker}" />
<DatePicker x:Name="hireDateDatePicker"
Margin="0,0,5,0"
DockPanel.Dock="Left"
SelectedDate="{Binding Path=CurrentInstructor.HireDate,
Mode=TwoWay,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}" />
</DockPanel>
<di:DisplayLabel x:Name="salaryLabel"
Grid.Row="3"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=salaryTextBox}" />
<DockPanel Grid.Row="3"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="salaryDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=salaryTextBox}" />
<TextBox x:Name="salaryTextBox"
Margin="0,0,5,0"
HorizontalAlignment="Stretch"
DockPanel.Dock="Left"
Text="{Binding Path=CurrentInstructor.Salary,
Mode=TwoWay,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}" />
</DockPanel>
</Grid>
<Grid Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="Auto"
Height="Auto"
Margin="12"
HorizontalAlignment="Stretch"
VerticalAlignment="Top">
<Button Width="75"
Height="23"
Margin="0,10,248,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=AddInstructorCommand}"
Content="Add" />
<Button Width="75"
Height="23"
Margin="0,10,167,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=DeleteInstructorCommand}"
Content="Delete" />
<Button x:Name="editCommitInstructorButton"
Width="75"
Height="23"
Margin="0,10,86,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=EditCommitInstructorCommand}"
Content="OK" />
<Button Width="75"
Height="23"
Margin="0,10,5,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=CancelEditInstructorCommand}"
Content="Cancel" />
</Grid>
<di:ValidationSummary x:Name="instructorValidationSummary"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="10,0,10,20"
Target="{Binding ElementName=instructorGrid}" />
<StackPanel Grid.Row="3"
Grid.Column="0"
Orientation="Vertical">
<TextBlock Margin="10,0"
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
Text="Courses Taught" />
<ListView x:Name="coursesListView"
MaxHeight="200"
Margin="10,10,10,20"
ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}"
ItemsSource="{Binding Path=CurrentInstructor.Courses}"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding CourseId}" Header="Course ID" />
<GridViewColumn DisplayMemberBinding="{Binding Title}" Header="Course Title" />
</GridView>
</ListView.View>
</ListView>
</StackPanel>
</Grid>
<Grid Width="Auto"
Height="Auto"
Margin="12,12,12,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top">
<Button Width="75"
Height="23"
Margin="0,5,410,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=RefreshInstructorCommand}"
Content="Refresh" />
<Button Width="75"
Height="23"
Margin="0,5,329,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=SubmitInstructorChangeCommand}"
Content="Save" />
<Button Width="75"
Height="23"
Margin="0,5,248,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=CancelInstructorChangeCommand}"
Content="Cancel" />
<Button Width="75"
Height="23"
Margin="0,5,167,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=RefreshAllCommand}"
Content="Refresh All" />
<Button Width="75"
Height="23"
Margin="0,5,86,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=SubmitAllChangeCommand}"
Content="Save All" />
<Button Width="75"
Height="23"
Margin="0,5,5,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=CancelAllChangeCommand}"
Content="Cancel All" />
</Grid>
</StackPanel>
</ScrollViewer>
</Grid>
</Page>