StudentManager/StudentManager/Editor/StudentsView.xaml
2024-09-10 19:17:56 +08:00

47 lines
2.5 KiB
XML

<UserControl x:Class="StudentManager.Editor.StudentsView"
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="{x:Type TextBlock}">
<Setter Property="Margin" Value="10,5"/>
<Setter Property="Width" Value="50"/>
</Style>
</UserControl.Resources>
<Grid>
<ListBox ItemsSource="{Binding StudentDatas}"
SelectedItem="{Binding SelectedStudent}">
<i:Interaction.Triggers>
<!--<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
Command="{Binding DataContext.SelectedCommand ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger>-->
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
CommandParameter="DetailView"
Command="{Binding DataContext.RegionTo ,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding Name}"/>
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding TotalsQuestions}"/>
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectionCount}"/>
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding UnCorrectCount}"/>
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding ErrorRate}"/>
<TextBlock Style="{StaticResource TextStyle}" Text="{Binding CorrectRate}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>