250 lines
15 KiB
XML
250 lines
15 KiB
XML
<UserControl x:Class="StudentManager.Editor.CheckView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:StudentManager.Editor"
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<UserControl.Resources>
|
|
<Style x:Key="TextStyle" TargetType="TextBlock">
|
|
<Setter Property="Width" Value="200"/>
|
|
</Style>
|
|
<Style x:Key="ModernMenuItemStyle" TargetType="MenuItem">
|
|
<Setter Property="Background" Value="White"/>
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Setter Property="Padding" Value="10,5"/>
|
|
<Setter Property="Margin" Value="20,10"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="MenuItem">
|
|
<Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch" CornerRadius="5" Height="20" Width="50">
|
|
<Grid>
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" ContentSource="Header"/>
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="DarkGray"/>
|
|
<Setter Property="Foreground" Value="White"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<!-- 定义 ContextMenu 的样式 -->
|
|
<Style x:Key="ModernContextMenuStyle" TargetType="ContextMenu">
|
|
<Setter Property="Background" Value="White"/>
|
|
<Setter Property="BorderBrush" Value="#FF007ACC"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ContextMenu">
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="10">
|
|
<StackPanel>
|
|
<ItemsPresenter/>
|
|
</StackPanel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<ContextMenu x:Key="MyModernContextMenu" Style="{StaticResource ModernContextMenuStyle}">
|
|
<MenuItem Header="查看详情" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Command="{Binding DataContext.RegionTo, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="DetailCheckView" Style="{StaticResource ModernMenuItemStyle}"/>
|
|
<MenuItem Header="删除" Command="{Binding Option2Command}" Style="{StaticResource ModernMenuItemStyle}"/>
|
|
</ContextMenu>
|
|
</UserControl.Resources>
|
|
<Grid Background="Transparent">
|
|
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="100"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
<Border CornerRadius="20"/>
|
|
|
|
<ListBox ItemsSource="{Binding StudentDatas}" ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0"
|
|
SelectedItem="{Binding SelectedStudent}">
|
|
<ListBox.Resources>
|
|
<Style TargetType="ListBox">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ListBox">
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="10">
|
|
<Border.Effect>
|
|
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
|
</Border.Effect>
|
|
<ScrollViewer Margin="0" Focusable="false">
|
|
<ItemsPresenter/>
|
|
</ScrollViewer>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style TargetType="ListBoxItem">
|
|
<Setter Property="Background" Value="White"/>
|
|
<Setter Property="Margin" Value="5"/>
|
|
<Setter Property="Padding" Value="10"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ListBoxItem">
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="1"
|
|
CornerRadius="5">
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter Property="Background" Value="#FF007ACC"/>
|
|
<Setter Property="Foreground" Value="White"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#FFBEE6FD"/>
|
|
<Setter Property="BorderBrush" Value="#FF3C7FB1"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ListBox.Resources>
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="SelectionChanged">
|
|
<i:InvokeCommandAction
|
|
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
|
|
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Name}"/>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
<Border Grid.Column="1">
|
|
<ScrollViewer Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Margin="0">
|
|
<ItemsControl ItemsSource="{Binding HomeWorkSet}" HorizontalAlignment="Left">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Background="#FFF9F9F9" BorderBrush="Gray" BorderThickness="0" CornerRadius="10" Margin="5" MouseRightButtonUp="Border_MouseRightButtonUp"
|
|
Padding="5" Height="240" Width="140" IsHitTestVisible="True">
|
|
<Border.Effect>
|
|
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
|
</Border.Effect>
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="MouseEnter">
|
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFFEFEFE"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="MouseLeave">
|
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFF9F9F9"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="MouseRightButtonDown">
|
|
<i:InvokeCommandAction Command="{Binding DataContext.HomeWorkSetSelectedCommand ,RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding }"/>
|
|
</i:EventTrigger>
|
|
|
|
</i:Interaction.Triggers>
|
|
|
|
<DockPanel LastChildFill="False">
|
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
|
|
|
|
<TextBlock TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Text="Lesson:"
|
|
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
|
|
<TextBlock TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Text="{Binding Lesson}"
|
|
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
|
|
</StackPanel>
|
|
|
|
<Border DockPanel.Dock="Top" BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5,0,5,10"/>
|
|
<Grid DockPanel.Dock="Top">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<StackPanel Orientation="Vertical">
|
|
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总题数" Margin="5" Foreground="Gray"
|
|
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
|
|
Text="{Binding TotalCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
</StackPanel>
|
|
|
|
<StackPanel Grid.Column="1" Orientation="Vertical">
|
|
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总错误数" Margin="5" Foreground="Gray"
|
|
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
|
|
Text="{Binding ErrorCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
<Border DockPanel.Dock="Top" BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5,0,5,10"/>
|
|
|
|
<Grid DockPanel.Dock="Top">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<StackPanel Orientation="Vertical">
|
|
<TextBlock TextWrapping="Wrap" FontSize="12" Text="错误率" Margin="5" Foreground="Gray"
|
|
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
|
|
Text="{Binding TotalCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
</StackPanel>
|
|
|
|
<StackPanel Grid.Column="1" Orientation="Vertical">
|
|
<TextBlock TextWrapping="Wrap" FontSize="12" Text="总正确数" Margin="5" Foreground="Gray"
|
|
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
<TextBlock TextWrapping="Wrap" FontSize="18" Margin="5"
|
|
Text="{Binding ErrorCount}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
|
|
<StackPanel.Resources>
|
|
<Style TargetType="Border">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Status}" Value="true">
|
|
<Setter Property="Background" Value="Green"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Status}" Value="false">
|
|
<Setter Property="Background" Value="Red"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</StackPanel.Resources>
|
|
|
|
<TextBlock TextWrapping="Wrap" FontSize="8" Margin="0,2" FontWeight="Bold"
|
|
Text="{Binding DateTime}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
|
|
|
<Border Height="10" Width="10" Margin="10,0" CornerRadius="20"/>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
|
|
|
|
|
|
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Grid>
|
|
</UserControl>
|