<UserControl x:Class="CurveModule.Views.Dialogs.CurveStatisticsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:helpers="clr-namespace:UIShare.Helpers;assembly=UIShare"
             Background="White"
             prism:ViewModelLocator.AutoWireViewModel="True"
             Width="900"
             Height="520"
             mc:Ignorable="d">
    <prism:Dialog.WindowStyle>
        <Style BasedOn="{StaticResource DialogUserManageStyle}"
               TargetType="Window" />
    </prism:Dialog.WindowStyle>
    <Grid>
        <GroupBox Padding="10,8,10,0"
                  Header="{Binding Title}"
                  helpers:WindowDragHelper.EnableWindowDrag="True">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <DataGrid Grid.Row="0"
                          ItemsSource="{Binding Results}"
                          AutoGenerateColumns="False"
                          IsReadOnly="True"
                          CanUserAddRows="False"
                          CanUserSortColumns="True"
                          Background="Transparent"
                          SelectionMode="Single"
                          HeadersVisibility="Column"
                          GridLinesVisibility="Horizontal"
                          BorderThickness="1"
                          BorderBrush="#DDD"
                          VerticalScrollBarVisibility="Auto"
                          HorizontalScrollBarVisibility="Auto">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="曲线名称"
                                            Binding="{Binding DisplayName}"
                                            Width="180"/>
                        <DataGridTextColumn Header="数据点数"
                                            Binding="{Binding PointCount}"
                                            Width="70"/>
                        <DataGridTextColumn Header="最大值"
                                            Binding="{Binding MaxText}"
                                            Width="100"/>
                        <DataGridTextColumn Header="最小值"
                                            Binding="{Binding MinText}"
                                            Width="100"/>
                        <DataGridTextColumn Header="平均值"
                                            Binding="{Binding AverageText}"
                                            Width="100"/>
                        <DataGridTextColumn Header="斜率 (/s)"
                                            Binding="{Binding SlopeText}"
                                            Width="120">
                            <DataGridTextColumn.ElementStyle>
                                <Style TargetType="TextBlock">
                                    <Setter Property="ToolTip" Value="线性回归斜率（值/秒）"/>
                                </Style>
                            </DataGridTextColumn.ElementStyle>
                        </DataGridTextColumn>
                        <DataGridTextColumn Header="积分 (·s)"
                                            Binding="{Binding IntegralText}"
                                            Width="130">
                            <DataGridTextColumn.ElementStyle>
                                <Style TargetType="TextBlock">
                                    <Setter Property="ToolTip" Value="梯形法积分值（单位×秒）"/>
                                </Style>
                            </DataGridTextColumn.ElementStyle>
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>

                <StackPanel Grid.Row="1"
                            Orientation="Horizontal"
                            HorizontalAlignment="Right"
                            Margin="5,8,5,12">
                    <Button Content="关闭"
                            Width="80"
                            Command="{Binding CloseCommand}"/>
                </StackPanel>
            </Grid>
        </GroupBox>
    </Grid>
</UserControl>
