<Page x:Class="ThickTcpUiInWindow.PgErrorAllTable"
      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:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
      mc:Ignorable="d" 
      d:DesignHeight="900" d:DesignWidth="960" Background="White"
      Title="Page_ErrorTable">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Converter/Dictionary_MyConv.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="Control" x:Key="iconPackStyle">
                <Setter Property="Width" Value="25"/>
                <Setter Property="Height" Value="25"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
            </Style>
            <Style TargetType="FrameworkElement" x:Key="backPackStyle">
                <Setter Property="Width" Value="50"/>
                <Setter Property="Height" Value="50"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="titlePackStyle">
                <Setter Property="Margin" Value="2"/>
                <Setter Property="FontSize" Value="16"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Foreground" Value="White"/>
            </Style>
            <Style TargetType="Button" x:Key="buttonStyle" BasedOn="{StaticResource ButtonStyle_empty}">
                <Setter Property="Margin" Value="20,0"/>
            </Style>
        </ResourceDictionary>
    </Page.Resources>
    <Grid Name="root_grid" >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
        </Grid.RowDefinitions>
        <Grid Background="{StaticResource Background_Title}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" >
                <Button Style="{StaticResource ButtonStyle_back2}" Click="button_back_Click" />
                <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="报警"/>
            </StackPanel>
            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" >
                <Button Style="{StaticResource buttonStyle}" Click="button_clear_click" >
                    <StackPanel Orientation="Vertical">
                        <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                            <Ellipse Style="{StaticResource backPackStyle}" Fill="White"/>
                            <iconPacks:PackIconMaterialDesign Kind="Clear" Style="{StaticResource iconPackStyle}" Foreground="#FFEE3232"/>
                        </Grid>
                        <TextBlock Text="清空" Style="{StaticResource titlePackStyle}"/>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Grid>



        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition  />
            </Grid.ColumnDefinitions>

            <Border Width="150" Background="{StaticResource Color_theme_activity}" Margin="0,5,5,5" >
                <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="历史报警&#x0a;列表" />
            </Border>
            <Grid Grid.Column="1" x:Name="grid_window">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="751*"/>
                    <ColumnDefinition Width="54*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid Grid.ColumnSpan="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Margin="5">
                        <Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_prepage_Click" Width="40" Height="40" Margin="5">
                            <Path Data="{StaticResource Geometry_arrow-left}" Fill="{StaticResource Color_theme_activity}" Stretch="Uniform"/>
                        </Button>
                        <StackPanel Orientation="Horizontal" Margin="5">
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="第"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding CurrentPage}"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="页"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="/"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="共"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding TotalPages}"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="页"/>
                        </StackPanel>
                        <Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_nextpage_Click" Width="40" Height="40" Margin="5">
                            <Path Data="{StaticResource Geometry_arrow-right}" Fill="{StaticResource Color_theme_activity}" Stretch="Uniform"/>
                        </Button>
                        <Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_newest_Click" Width="40" Height="40" Margin="5">
                            <Path Data="{StaticResource Geometry_arrow-collapse-right}" Fill="{StaticResource Color_theme_activity}" Stretch="Uniform"/>
                        </Button>
                        <StackPanel Orientation="Horizontal" Margin="20,5">
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="显示"/>
                            <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Size}" MinWidth="40"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="行"/>
                        </StackPanel>
                    </StackPanel>
                </Grid>

                <DataGrid Grid.Row="1" ItemsSource="{Binding Record}" AutoGenerateColumns="False" IsReadOnly="True" Grid.ColumnSpan="2" >
                    <DataGrid.CellStyle>
                        <Style TargetType="DataGridCell">
                            <Setter Property="FontSize" Value="20"/>
                        </Style>
                    </DataGrid.CellStyle>
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Time,StringFormat={}{0:MM/dd HH:mm}}" >
                            <DataGridTextColumn.Header>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="时间" />
                                </StackPanel>
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding State}" >
                            <DataGridTextColumn.Header>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="状态" />
                                </StackPanel>
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Description}" >
                            <DataGridTextColumn.Header>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="报警描述" />
                                </StackPanel>
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>

        </Grid>



    </Grid>
</Page>

