<UserControl x:Class="MeterVision.Stand.UCStandMain"
             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:MeterVision.Stand"
             xmlns:zdfflatui="clr-namespace:ZdfFlatUI;assembly=WPF.UI"
             xmlns:img="clr-namespace:MeterVision.UC"
             xmlns:local1="clr-namespace:MeterVision.Converter"
             xmlns:local2="clr-namespace:MeterVision"
             xmlns:station="clr-namespace:MeterVision.Station"
             mc:Ignorable="d" 
             Padding="5 2 5 5"
             Background="WhiteSmoke"
             d:DesignHeight="800" d:DesignWidth="1366">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
        <local1:InverseBoolToVisibilityConverter x:Key="InverseBoolToVisibilityConverter" />

        <Style TargetType="ContextMenu">
            <Setter Property="Background" Value="White"/>
            <Setter Property="BorderBrush" Value="#DDDDDD"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>

        <Style TargetType="MenuItem">
            <Setter Property="Padding" Value="5,2"/>
            <!--<Setter Property="Icon" Value="{StaticResource DefaultIcon}"/>-->
        </Style>
    </UserControl.Resources>
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="220" x:Name="colLeft"/>
            <ColumnDefinition Width="*" />
            <!--<ColumnDefinition Width="400" x:Name="colRight" />-->
        </Grid.ColumnDefinitions>

        <Border Grid.Column="0" BorderBrush="#C0C0C0" BorderThickness="0 0 1 0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="70" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="40" />
                </Grid.RowDefinitions>

                <Grid Grid.Row="0" Margin="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <!--<TextBlock Text="标准模板列表" FontSize="14px" TextWrapping="Wrap" FontWeight="Bold" 
                               VerticalAlignment="Center" Margin="2"/>-->
                    <zdfflatui:FlatButton Grid.Column="0" x:Name="btnAddStand" HorizontalAlignment="Center"
                                              Background="#4CAF50" Foreground="White" Content="新建模板"
                                          Click="BtnAddStand_Click"
                                              Width="80" Height="28" FontSize="13" Margin="0 0 5 0" />
                    <zdfflatui:FlatButton Grid.Column="1" x:Name="btnDelStand" HorizontalAlignment="Center"
                                              Background="#FF4C4C" Foreground="White" Content="删除模板"
                                          Click="BtnDelStand_Click"
                                              Width="80" Height="28" FontSize="13" Margin="0 0 5 0" />

                    <zdfflatui:FlatButton Grid.Column="2" x:Name="btnRefresh" HorizontalAlignment="Center"
                                              Background="#2196F3" Foreground="White" Content="🔄"
                                          ToolTip="刷新数据列表"
                                          Click="BtnRefresh_Click" Margin="0 0 10 0" Width="30" Height="28" FontSize="20px"  />

                    <Grid Grid.Row="1" Grid.ColumnSpan="3" Margin="2 0 5 0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        
                        <zdfflatui:FlatButton Grid.Column="0" x:Name="btnExportStand" HorizontalAlignment="Left"
                                              Background="#2196F3" Foreground="White" Content="全部导出"
                                          Click="BtnExportStand_Click"  Padding="5 0 5 0"  Height="28" FontSize="13" Margin="0 0 0 0" />
                        
                        <zdfflatui:FlatButton Grid.Column="1" x:Name="btnPartExportStand" HorizontalAlignment="Left"
                                              Background="#2196F3" Foreground="White" Content="部分导出"
                                          Click="BtnPartExportStand_Click"  Padding="5 0 5 0"  Height="28" FontSize="13" Margin="0 0 0 0" />
                        
                        <zdfflatui:FlatButton Grid.Column="2" x:Name="btnImportStand" HorizontalAlignment="Left"
                                              Background="#2196F3" Foreground="White" Content="导人数据"
                                          Click="BtnImportStand_Click" Padding="5 0 5 0" Height="28" FontSize="13" Margin="0 0 0 0" />
                    </Grid>



                </Grid>

                <!--OliveDrab-->
                <Border Grid.Row="1" BorderThickness="0" BorderBrush="#C0C0C0" Margin="0 0 5 0">
                    <!--嵌套一个DataGrid-->
                    <DataGrid x:Name="dgStand" GridLinesVisibility="All" HorizontalGridLinesBrush="Transparent" VerticalGridLinesBrush="Transparent"
                              BorderBrush="#D3D3D3" HeadersVisibility="Column" SelectionMode="Single" SelectionUnit="FullRow"
                              HorizontalScrollBarVisibility="Disabled" CanUserReorderColumns="False" RowHeight="NaN"
                              SelectedItem="{Binding SelectedStandItem,Mode=TwoWay}"
                              AutoGenerateColumns="False" CanUserAddRows="False" HorizontalAlignment="Stretch"
                              VerticalAlignment="Stretch" Background="White" Padding="5" Margin="0">
                        <DataGrid.Resources>
                            <Style TargetType="DataGridColumnHeader">
                                <Setter Property="Height" Value="40" />
                                <!--Setter Property="Background" Value="White" /-->
                                <Setter Property="Foreground" Value="Black" />
                                <Setter Property="FontSize" Value="13px" />
                                <Setter Property="FontWeight" Value="Bold" />
                                <Setter Property="BorderBrush" Value="#D3D3D3" />
                                <Setter Property="Background" Value="White" />
                                <!--<Setter Property="BorderThickness" Value="0,0,1,1" />-->
                                <Setter Property="BorderThickness" Value="0,0,0,0" />
                                <Setter Property="HorizontalContentAlignment" Value="Center" />
                                <Setter Property="Margin" Value="0 0 0 0" />
                                <Setter Property="Padding" Value="5" />
                            </Style>

                            <!-- 自定义行的选中样式 -->
                            <Style TargetType="DataGridRow">
                                <Style.Triggers>
                                    <!-- 当行被选中时 -->
                                    <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True">
                                        <!-- 设置选中行的背景色 -->
                                        <Setter Property="Background" Value="Transparent"/>
                                        <Setter Property="BorderThickness" Value="1" />
                                        <Setter Property="BorderBrush" Value="CornflowerBlue" />
                                    </DataTrigger>
                                </Style.Triggers>
                                <Setter Property="Margin" Value="0,0,5,5"/>
                                <Setter Property="BorderThickness" Value="1" />
                                <Setter Property="BorderBrush" Value="CadetBlue" />
                                <!-- 或者使用 Padding 属性，取决于你想要的效果 -->
                                <!-- <Setter Property="Padding" Value="0,5,0,5"/> -->
                            </Style>
                            <!-- 自定义选中单元格的背景色 -->
                            <Style TargetType="DataGridCell">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True">
                                        <!-- 设置选中单元格的背景色 -->
                                        <Setter Property="Background" Value="AliceBlue"/>
                                        <Setter Property="BorderBrush" Value="Red" />
                                        <!-- 设置选中单元格的前景色 -->
                                        <!--<Setter Property="Foreground" Value="Black"/>-->
                                    </DataTrigger>
                                </Style.Triggers>
                                <!--<Setter Property="Foreground" Value="White" />-->
                                <Setter Property="BorderBrush" Value="SeaGreen" />
                                <Setter Property="BorderThickness" Value="0" />
                            </Style>
                        </DataGrid.Resources>

                        <DataGrid.ContextMenu>
                            <ContextMenu>
                                <MenuItem x:Name="miUpdateStandname" Header="修改模板名称" Click="MiUpdateStandname_Click" >
                                    <MenuItem.Icon>
                                        <Image Source="pack://application:,,,/MeterVision;component/Assest/mi_update1.png" Width="16" Height="16"/>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <Separator />
                                <MenuItem x:Name="miDeleteStand" Header="删除模板" Click="MiDeleteStand_Click" >
                                    <MenuItem.Icon>
                                        <Image Source="pack://application:,,,/MeterVision;component/Assest/mi_delete.png" Width="16" Height="16"/>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <Separator />
                                <MenuItem x:Name="miExport" Header="导出已标数据到JSON" Click="MiExport_Click" >
                                    <MenuItem.Icon>
                                        <Image Source="pack://application:,,,/MeterVision;component/Assest/export.png" Width="16" Height="16"/>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem x:Name="miPartExport" Header="导出部分数据到JSON" Click="MiPartExport_Click" >
                                    <MenuItem.Icon>
                                        <Image Source="pack://application:,,,/MeterVision;component/Assest/export.png" Width="16" Height="16"/>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <Separator />
                                <MenuItem x:Name="miImport" Header="导入标注JSON数据" Click="MiImport_Click" >
                                    <MenuItem.Icon>
                                        <Image Source="pack://application:,,,/MeterVision;component/Assest/import.png" Width="16" Height="16"/>
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>

                        <DataGrid.Columns>
                            <DataGridTemplateColumn  Width="*">
                                <DataGridTemplateColumn.Header>
                                    <!--<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=TotalStandRecords,
                                        StringFormat='模板列表 （共 {0} 个）',Mode=OneWay}" />-->
                                    <TextBlock Text="模板列表" FontSize="14px" />
                                </DataGridTemplateColumn.Header>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Vertical"  VerticalAlignment="Stretch" Margin="5 5 10 5">
                                            <Border  HorizontalAlignment="Stretch" BorderBrush="#D3D3D3" BorderThickness="0 0 0 1" Padding="0" Margin="0" >
                                                                                                
                                                <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                                    <Border VerticalAlignment="Center" Margin="0 0 0 5">
                                                        <Grid>
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="*" />
                                                                <ColumnDefinition Width="Auto" />
                                                            </Grid.ColumnDefinitions>

                                                            <TextBlock Text="{Binding Index,StringFormat='{}{0}.'}" Grid.Column="0" FontSize="14px" Foreground="#000000" 
                                                                       VerticalAlignment="Center" />
                                                            <TextBlock Text="{Binding StandTypeName}" Grid.Column="1" FontSize="13px" 
                                                                       HorizontalAlignment="Stretch" TextAlignment="Right"  
                                                                       Foreground="{Binding StandTypeNameColor}"/>
                                                        </Grid>
                                                    </Border>

                                                    <TextBlock Text="{Binding StandName}" FontWeight="Normal" HorizontalAlignment="Center"
                                                            TextWrapping="Wrap" TextAlignment="Center"
                                                    Foreground="#000000" FontSize="14px" VerticalAlignment="Center" Margin="0 0 0 0" />
                                                    <TextBlock Text="{Binding StandTime}" FontSize="13px" TextAlignment="Center" 
                                                            Foreground="#333333" Margin="0 5 0 5"/>
                                                </StackPanel>
                                                
                                                
                                            </Border>

                                            <StackPanel Orientation="Vertical">
                                                <StackPanel Orientation="Horizontal" Height="26" Margin="0 5 0 0">
                                                    <TextBlock Text="数据记录数：" TextAlignment="Left" FontSize="14px" VerticalAlignment="Center" Width="90" Foreground="#666666"/>
                                                    <TextBlock Text="{Binding StandCount}" Width="100" TextAlignment="Left" FontSize="14px" FontWeight="Normal" Foreground="#000000" VerticalAlignment="Center"/>
                                                </StackPanel>
                                            </StackPanel>

                                        </StackPanel>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>

                <Grid Grid.Row="2" Background="WhiteSmoke">
                    <StackPanel Height="35" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">
                        <!--<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=TotalStandRecords,
                                        StringFormat='模板列表 （共 {0} 个）',Mode=OneWay}" />-->
                        <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=TotalStandRecords,StringFormat='共 {0} 条数据',Mode=OneWay}" Margin="5" VerticalAlignment="Center" FontSize="13px"/>
                        <ComboBox Width="55" Margin="5" FontSize="13px" 
                              ItemsSource="{x:Static local2:ThisApp.PageSizeOptions}"
                              SelectedValue="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=mConfigItem.PageSize1}"/>
                    </StackPanel>
                </Grid>
                

                <Grid Grid.Row="3" Background="WhiteSmoke">
                    <!--<TextBlock Text="{Binding StandItemList.Count, StringFormat='{}{0}个标准模板'}" VerticalAlignment="Center" HorizontalAlignment="Center"  FontSize="14px"/>-->
                    <StackPanel Height="35" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">
                        <Button x:Name="btnStandPrePage" Content="上一页" Width="55" Margin="5" FontSize="13px" Click="BtnStandPrePage_Click"/>
                        <!--<TextBlock Text="{Binding StandPage.PageNumber}/{Binding StandPage.PageCount}" Margin="5" FontSize="13px" VerticalAlignment="Center"/>-->
                        <TextBlock Margin="5" FontSize="13px" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <TextBlock.Text>
                                <!--<MultiBinding StringFormat="{}{0}/{1}页">-->
                                <MultiBinding StringFormat="第{0}/{1}页">
                                    <Binding Path="StandPage.PageNumber"/>
                                    <Binding Path="StandPage.PageCount"/>
                                </MultiBinding>
                            </TextBlock.Text>
                        </TextBlock>
                        <Button x:Name="btnStandNexPage" Content="下一页" Width="55" Margin="5" FontSize="13px" Click="BtnStandNextPage_Click"/>
                    </StackPanel>
                </Grid>
                
            </Grid>
        </Border>

        <Grid Grid.Column="1" Background="WhiteSmoke">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300" />
                <ColumnDefinition Width="0" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
             
            <!--右侧上空间-->
            <Grid Grid.Column="0" Background="WhiteSmoke">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="0"/>
                </Grid.ColumnDefinitions>
                
                <!--右侧上左站点明细-->
                <Border Grid.Column="0" BorderBrush="#D3D3D3" BorderThickness="0 0 1 0" Padding="0 0 5 0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="70" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                        </Grid.RowDefinitions>

                        <!--右上空间的上方状态栏-->
                        <Border Grid.Row="0" BorderBrush="#D3D3D3" BorderThickness="0 0 0 0" Padding="0 2 0 2" Margin="2 0 2 0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width= "60" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <StackPanel Grid.Column="0" Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="5 0 2 0">
                                    <Button Content="◀️" x:Name="btnLeftCtl" FontSize="20px" Width="28" Height="28" Visibility="Visible"
                                        Click="BtnLeftCtl_Click" Foreground="White" Background="#333333" Margin="0 0 5 0" />
                                    <TextBlock x:Name="txtStandName" Text="1."  Visibility="Visible"
                                               FontSize="14px" FontWeight="Bold" VerticalAlignment="Center" />
                                </StackPanel>

                                <StackPanel Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
                                    <TextBlock Text="站点:" VerticalAlignment="Center" Margin="5 0 5 0"
                                        Foreground="Black" FontSize="14px" />
                                    <TextBox x:Name="txtFindStationId" FontSize="14px" Width="120" Text="12345678901" VerticalAlignment="Center" 
                                        Padding="2" Margin="0 0 10 0" PreviewTextInput="TextBox_PreviewTextInput" />
                                </StackPanel>

                                <StackPanel Grid.Column="2" Grid.Row="0" VerticalAlignment="Center">
                                    <!--Content="🔄"-->
                                    <zdfflatui:FlatButton Grid.Column="2" x:Name="btnRefreshStation" HorizontalAlignment="Center"
                                              Background="#2196F3" Foreground="White" Content="刷新"
                                          ToolTip="刷新数据列表" Visibility="Collapsed"
                                          Click="BtnRefreshStation_Click" Margin="0 0 5 0"
                                              Width="60" Height="28" FontSize="14px"  />
                                </StackPanel>

                                <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal">
                                    <TextBlock Text="配置:" VerticalAlignment="Center" Margin="5 0 5 0"
                                        Foreground="Black" FontSize="14px" />
                                    <ComboBox Grid.Column="1" x:Name="cmbRunFlag" FontSize="13px" Foreground="#000000" 
                                      DisplayMemberPath="Value" SelectedValuePath="Key" Width="120"
                                      ItemsSource="{Binding StationMarkTypeKVs}"
                                      SelectedValue="{Binding SelectedStationMarkType,Mode=TwoWay}"                                        
                                      Margin="0,0,10,0" Padding="4" VerticalAlignment="Center"/>
                                </StackPanel>

                                <StackPanel Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">
                                    <zdfflatui:FlatButton Grid.Column="1" x:Name="btnQuery" HorizontalAlignment="Center"
                                              Background="#2196F3" Content="查询"
                                                Click="BtnQuery_Click" Foreground="White"
                                              Width="60" Height="28" FontSize="14" Margin="0 0 5 0" />
                                </StackPanel>
                                
                            </Grid>
                        </Border>
                        
                        <Border Grid.Row="1">
                            <station:UCStationGrid x:Name="ucStationGrid" Padding="5 5 5 5" />
                        </Border>
                        <!-- 底部分页控件 -->
                        <StackPanel Grid.Row="2" Height="35" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">
                            <TextBlock Text="{Binding ElementName=ucStationGrid,Path=TotalRecords,StringFormat='共 {0} 条数据'}" Margin="5" VerticalAlignment="Center" FontSize="13px"/>
                            <ComboBox Width="55" Margin="5" FontSize="13px" 
                              ItemsSource="{x:Static local2:ThisApp.PageSizeOptions}"
                              SelectedValue="{Binding ElementName=ucStationGrid,Path=mConfigItem.PageSize2}"/>
                            <!--<Button x:Name="btnStationFirstPage" Content="首页" Width="55" Margin="5" FontSize="13px" Click="BtnStationFirstPage_Click"/>
                            <Button x:Name="btnStationPrePage" Content="上一页" Width="55" Margin="5" FontSize="13px" Click="BtnStationPrePage_Click"/>
                            <TextBlock  Margin="5" FontSize="13px" VerticalAlignment="Center">
                                <TextBlock.Text>
                                    --><!--<MultiBinding StringFormat="第 {0} 页 / 共 {1} 页">--><!--
                                    <MultiBinding StringFormat="{}{0}/{1}">
                                        <Binding ElementName="ucStationGrid" Path="StationPage.PageNumber"/>
                                        <Binding ElementName="ucStationGrid" Path="StationPage.PageCount"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>

                            <Button x:Name="btnStationNextPage" Content="下一页" Width="55" Margin="5" FontSize="13px" Click="BtnStationNextPage_Click"/>
                            <Button x:Name="btnStationLastPage" Content="尾页" Width="55" Margin="5" FontSize="13px" Click="BtnStationLastPage_Click"/>-->
                            <TextBox x:Name="txtStationPageNumber" Width="40" Margin="5" TextAlignment="Center" FontSize="13px"
                                 Text="{Binding ElementName=ucStationGrid,Path=StationPage.PageNumber,Mode=OneWay}" Visibility="Visible"
                                 MaxLength="3" PreviewTextInput="TextBox_PreviewTextInput" VerticalContentAlignment="Center"/>
                            <Button x:Name="btnStationSpeciPage" Content="跳转" Width="50" Margin="5" FontSize="13px" 
                                    Visibility="Visible" Click="BtnStationSpeciPage_Click"/>
                        </StackPanel>

                        <StackPanel Grid.Row="3" Height="35" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">
                            <!--<TextBlock Text="{Binding ElementName=ucStationGrid,Path=TotalRecords,StringFormat='共 {0} 条数据'}" Margin="5" VerticalAlignment="Center" FontSize="13px"/>
                            <ComboBox Width="55" Margin="5" FontSize="13px" 
                              ItemsSource="{x:Static local2:ThisApp.PageSizeOptions}"
                              SelectedValue="{Binding ElementName=ucStationGrid,Path=mConfigItem.PatchPageSize}"/>-->
                            <Button x:Name="btnStationFirstPage" Content="首页" Width="50" Margin="5" FontSize="13px" Click="BtnStationFirstPage_Click"/>
                            <Button x:Name="btnStationPrePage" Content="上一页" Width="50" Margin="5" FontSize="13px" Click="BtnStationPrePage_Click"/>
                            <TextBlock  Margin="5" FontSize="13px" VerticalAlignment="Center">
                                <TextBlock.Text>
                                    <!--<MultiBinding StringFormat="第 {0} 页 / 共 {1} 页">-->
                                    <MultiBinding StringFormat="{}{0}/{1}">
                                        <Binding ElementName="ucStationGrid" Path="StationPage.PageNumber"/>
                                        <Binding ElementName="ucStationGrid" Path="StationPage.PageCount"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>

                            <Button x:Name="btnStationNextPage" Content="下一页" Width="50" Margin="5" FontSize="13px" Click="BtnStationNextPage_Click"/>
                            <Button x:Name="btnStationLastPage" Content="尾页" Width="50" Margin="5" FontSize="13px" Click="BtnStationLastPage_Click"/>
                            <!--<TextBox x:Name="txtStationPageNumber" Width="40" Margin="5" TextAlignment="Center" FontSize="13px"
                                 Text="{Binding ElementName=ucStationGrid,Path=StationPage.PageNumber,Mode=OneWay}"
                                 MaxLength="3" PreviewTextInput="TextBox_PreviewTextInput" VerticalContentAlignment="Center"/>
                            <Button x:Name="btnStationSpeciPage" Content="跳转" Width="55" Margin="5" FontSize="13px" Click="BtnStationSpeciPage_Click"/>-->
                        </StackPanel>
                    </Grid>
                </Border>
                <!--右侧上左站点明细结束-->
            </Grid>
            <!--右侧上空间结束-->

            <GridSplitter Grid.Column="1" Width="2" Background="Gray"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Stretch"
                      ShowsPreview="True"/>

            <!--右侧下空间开始-->
            <Grid Grid.Column="2" Background="WhiteSmoke">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="400" x:Name="colRight" />
                </Grid.ColumnDefinitions>

                <!--中间明细列表-->
                <Border Grid.Column="0" BorderBrush="#D3D3D3" BorderThickness="0 0 1 0" Padding="0 0 5 0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="40" />
                        </Grid.RowDefinitions>

                        <Grid x:Name="pnlDetailsTitle" Grid.Row="0" Visibility="Visible">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="5 0 2 0">
                                <!--<Button Content="◀️" x:Name="btnLeftCtl" FontSize="20px" Width="28" Height="28" Visibility="Visible"
                                    Click="BtnLeftCtl_Click" Foreground="White" Background="#333333" Margin="0 0 5 0" />-->
                                <TextBlock x:Name="txtStationName" Text="请选择上方站点" FontSize="14px" FontWeight="Bold" VerticalAlignment="Center" />
                                <!--<TextBlock Text="[2024-10-23 10:25:39]" FontSize="13px"  VerticalAlignment="Center" Margin="2 0 0 0"/>-->
                            </StackPanel>
                            <StackPanel x:Name="pnlDetailsFunc" Visibility="Visible" Orientation="Horizontal" HorizontalAlignment="Right">
                                <!--<TextBlock Text="点击开始识别" VerticalAlignment="Center" Margin="0 0 5 0" 
                                   Foreground="DarkGreen" FontSize="13px" FontWeight="Bold"/>-->
                                <!--zdfflatui:FlatButton x:Name="btnStandExport" HorizontalAlignment="Right"
                                              Click="BtnStandExport_Click"
                                              Background="#2196F3" Content="导出模板" Foreground="White"
                                              Width="80" Height="28" FontSize="13" Margin="0 0 0 0" /-->
                                <!--zdfflatui:FlatButton x:Name="btnSelectImageFloder" Background="#2196F3" Foreground="White" Content="选择图片文件夹" 
                                              Click="BtnSelectImageFloder_Click" 
                                              Width="100" Height="28" FontSize="13" Margin="10 0 0 0" /-->
                                <zdfflatui:FlatButton Grid.Column="2" x:Name="btnRefreshDetail" HorizontalAlignment="Center"
                                              Background="#2196F3" Foreground="White" Content="🔄"
                                          ToolTip="刷新数据列表"
                                          Click="BtnRefreshDetail_Click" Margin="10 0 10 0"
                                              Width="30" Height="28" FontSize="20px"  />
                                <Button Content="▶️" x:Name="btnRightCtl" FontSize="20px" Width="28" Height="28" Visibility="Visible"
                                    Click="BtnRightCtl_Click"
                                    Foreground="White" Background="#333333" Margin="0 0 5 0" />
                            </StackPanel>
                        </Grid>

                        <Border Grid.Row="1">
                            <local:UCStandGrid x:Name="ucStandGird" Padding="5 5 5 5" />
                        </Border>
                        <!-- 底部分页控件 -->
                        <StackPanel Grid.Row="2" Height="35" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">
                            <!--<TextBlock Text="共 100 条数据" Margin="5" VerticalAlignment="Center" FontSize="13px"/>-->
                            <!--<TextBlock Text="{Binding mConfigItem.PageSize}" Margin="5" VerticalAlignment="Center" FontSize="13px"/>-->
                            <TextBlock Text="{Binding ElementName=ucStandGird,Path=TotalRecords,StringFormat='共 {0} 条数据'}" Margin="5" VerticalAlignment="Center" FontSize="13px"/>
                            <ComboBox Width="55" Margin="5" FontSize="13px" 
                                ItemsSource="{x:Static local2:ThisApp.PageSizeOptions}"
                                SelectedValue="{Binding mConfigItem.PageSize3}"/>

                            <!--<ComboBox Width="60" Margin="5" FontSize="13px" SelectedValue="{Binding mConfigItem.PageSize}" SelectedValuePath="Content">
                        <ComboBoxItem Content="10"/>
                        <ComboBoxItem Content="20"/>
                        <ComboBoxItem Content="50"/>
                    </ComboBox>-->
                            <Button x:Name="btnStandDetailFirstPage" Content="首页" Width="55" Margin="5" FontSize="13px" Click="BtnStandDetailFirstPage_Click"/>
                            <Button x:Name="btnStanddetailPrePage" Content="上一页" Width="55" Margin="5" FontSize="13px" Click="BtnStanddetailPrePage_Click"/>
                            <!--<TextBlock Text="第 2 页 / 共 10 页" Margin="5" FontSize="13px" VerticalAlignment="Center"/>-->
                            <!--<TextBlock Text="{Binding ElementName=ucStandGird,Path=StandDetailPage.PageCount}" Margin="5" FontSize="13px" VerticalAlignment="Center"/>-->
                            <TextBlock  Margin="5" FontSize="13px" VerticalAlignment="Center">
                                <TextBlock.Text>
                                    <MultiBinding StringFormat="第 {0} 页 / 共 {1} 页">
                                        <Binding ElementName="ucStandGird" Path="StandDetailPage.PageNumber"/>
                                        <Binding ElementName="ucStandGird" Path="StandDetailPage.PageCount"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>

                            <Button x:Name="btnStandDetailNextPage" Content="下一页" Width="55" Margin="5" FontSize="13px" Click="BtnStandDetailNextPage_Click"/>
                            <Button x:Name="btnStandDetailLastPage" Content="尾页" Width="55" Margin="5" FontSize="13px" Click="BtnStandDetailLastPage_Click"/>
                            <TextBox x:Name="txtStandDetailPageNumber" Width="55" Margin="5" TextAlignment="Center" FontSize="13px"
                             Text="{Binding ElementName=ucStandGird,Path=StandDetailPage.PageNumber,Mode=OneWay}"
                             MaxLength="5" PreviewTextInput="TextBox_PreviewTextInput" VerticalContentAlignment="Center"/>
                            <Button x:Name="btnStandDetailSpeciPage" Content="跳转" Width="55" Margin="5" FontSize="13px" Click="BtnStandDetailSpeciPage_Click"/>
                        </StackPanel>
                    </Grid>
                </Border>

                <!--右侧页签TabControl-->
                <Border Grid.Column="1" Background="White">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Border Grid.Row="0" BorderBrush="#D3D3D3" Background="WhiteSmoke" BorderThickness="0 0 0 0" Padding="0 2 0 2" Margin="2 0 2 0" >
                            <!--Text="{Binding SelectedSingleItemIndex,Mode=OneWay}"-->
                            <TextBlock Grid.Column="0" x:Name="txtRightItemIndex" Text="1." Margin="10 0 0 0"
                                   TextWrapping="Wrap" FontWeight="Bold" FontSize="14px" VerticalAlignment="Center" />
                        </Border>

                        <TabControl Grid.Row="1" Margin="5" BorderBrush="#D3D3D3" BorderThickness="1">
                            <TabItem Header="图片信息" FontSize="14px" Margin="0" Padding="10 5 10 5">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="2*" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                
                                    <Border x:Name="pnlImage" Grid.Row="0" BorderThickness="1" BorderBrush="Transparent">
                                        <img:UCImage x:Name="ucImageSource" />
                                    </Border>
                                </Grid>
                            </TabItem>
                        </TabControl>
                    </Grid>
                </Border>
            </Grid>
            <!--右侧下空间结束-->
            
        </Grid>
        
        

    </Grid>
</UserControl>
