<Page x:Class="SchoolSample.CoursePage"
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:local="clr-namespace:SchoolSample"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Course"
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.CoursePageTitle, Source={StaticResource ApplicationResources}}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.RowSpan="3"
Grid.ColumnSpan="2"
BorderBrush="Black"
BorderThickness="1"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect ShadowDepth="3" />
</Border.Effect>
</Border>
<ListView x:Name="courseListView"
Grid.Row="0"
Grid.Column="0"
MaxHeight="200"
Margin="10,20"
IsEnabled="{Binding CourseListIsEnabled}"
ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}"
ItemsSource="{Binding Path=AllCoursesSource.View}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding CourseId}" Header="Course ID" />
<GridViewColumn DisplayMemberBinding="{Binding Title}" Header="Title" />
</GridView>
</ListView.View>
</ListView>
<Grid x:Name="courseGrid"
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" />
</Grid.RowDefinitions>
<di:DisplayLabel x:Name="titleLabel"
Grid.Row="0"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=titleTextBox}" />
<DockPanel Grid.Row="0"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="titleDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=titleTextBox}" />
<TextBox x:Name="titleTextBox"
Margin="0,0,5,0"
HorizontalAlignment="Stretch"
DockPanel.Dock="Left"
Text="{Binding Path=CurrentCourse.Title,
Mode=TwoWay,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}" />
</DockPanel>
<di:DisplayLabel x:Name="instructorLabel"
Grid.Row="1"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=instructorComboBox}" />
<DockPanel Grid.Row="1"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="instructorDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=instructorComboBox}" />
<local:ComboBoxEx x:Name="instructorComboBox"
Margin="0,0,5,0"
DisplayMemberPath="Name"
DockPanel.Dock="Left"
ItemsSource="{Binding Path=AllInstructorsSource.View}"
SelectedValuePath="PersonId"
SelectedValueProper="{Binding Path=CurrentCourse.InstructorId,
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=AddCourseCommand}"
Content="Add" />
<Button Width="75"
Height="23"
Margin="0,10,167,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=DeleteCourseCommand}"
Content="Delete" />
<Button x:Name="editCommitCourseButton"
Width="75"
Height="23"
Margin="0,10,86,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=EditCommitCourseCommand}"
Content="OK" />
<Button Width="75"
Height="23"
Margin="0,10,5,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=CancelEditCourseCommand}"
Content="Cancel" />
</Grid>
<di:ValidationSummary x:Name="courseValidationSummary"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="10,0,10,20"
Target="{Binding ElementName=courseGrid}" />
</Grid>
<TextBlock Margin="0,10"
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
Text="Course Enrollment" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.RowSpan="3"
Grid.ColumnSpan="2"
BorderBrush="Black"
BorderThickness="1"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect ShadowDepth="3" />
</Border.Effect>
</Border>
<ListView x:Name="enrollmentListView"
Grid.Row="0"
Grid.Column="0"
MaxHeight="200"
Margin="10,20"
IsEnabled="{Binding EnrollmentListIsEnabled}"
ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}"
ItemsSource="{Binding Path=EnrollmentsSource.View}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding EnrollmentId}" Header="Enrollment ID" />
<GridViewColumn DisplayMemberBinding="{Binding Student.Name}" Header="Student Name" />
</GridView>
</ListView.View>
</ListView>
<Grid x:Name="enrollmentGrid"
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" />
</Grid.RowDefinitions>
<di:DisplayLabel x:Name="studentLabel"
Grid.Row="0"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=studentComboBox}" />
<DockPanel Grid.Row="0"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="studentDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=studentComboBox}" />
<local:ComboBoxEx x:Name="studentComboBox"
Margin="0,0,5,0"
DisplayMemberPath="Name"
DockPanel.Dock="Left"
IsHitTestVisible="{Binding Path=StudentComboIsEditable}"
IsTabStop="{Binding Path=StudentComboIsEditable}"
ItemsSource="{Binding Path=AllStudentsSource.View}"
SelectedValuePath="PersonId"
SelectedValueProper="{Binding Path=CurrentEnrollment.StudentId,
Mode=TwoWay,
NotifyOnValidationError=True,
ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}" />
</DockPanel>
<di:DisplayLabel x:Name="paidLabel"
Grid.Row="1"
Grid.Column="0"
Margin="0,0,10,10"
Target="{Binding ElementName=paidCheckBox}" />
<DockPanel Grid.Row="1"
Grid.Column="1"
Margin="0,0,10,10"
LastChildFill="True">
<di:DescriptionViewer x:Name="paidDescriptionViewer"
DockPanel.Dock="Right"
Target="{Binding ElementName=paidCheckBox}" />
<CheckBox x:Name="paidCheckBox"
Margin="0,0,5,0"
DockPanel.Dock="Left"
IsChecked="{Binding Path=CurrentEnrollment.Paid,
Mode=TwoWay}" />
</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=AddEnrollmentCommand}"
Content="Add" />
<Button Width="75"
Height="23"
Margin="0,10,167,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=DeleteEnrollmentCommand}"
Content="Delete" />
<Button x:Name="editCommitEnrollmentButton"
Width="75"
Height="23"
Margin="0,10,86,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=EditCommitEnrollmentCommand}"
Content="OK" />
<Button Width="75"
Height="23"
Margin="0,10,5,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=CancelEditEnrollmentCommand}"
Content="Cancel" />
</Grid>
<di:ValidationSummary x:Name="enrollmentValidationSummary"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="10,0,10,20"
Target="{Binding ElementName=enrollmentGrid}" />
</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=RefreshCourseCommand}"
Content="Refresh" />
<Button Width="75"
Height="23"
Margin="0,5,329,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=SubmitCourseChangeCommand}"
Content="Save" />
<Button Width="75"
Height="23"
Margin="0,5,248,5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding Path=CancelCourseChangeCommand}"
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>