<UserControl x:Class="MeterVision.Station.UCStationMain"
             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.Station"
             xmlns:zdfflatui="clr-namespace:ZdfFlatUI;assembly=WPF.UI"
             xmlns:local2="clr-namespace:MeterVision"
             mc:Ignorable="d" 
             Background="WhiteSmoke"
             Padding="5 2 5 5"
             d:DesignHeight="800" d:DesignWidth="1000">
    <Grid>
        <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>

                <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="300" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="站点列表-管理水表识别时所需的参数" 
                                   TextWrapping="Wrap" FontWeight="Bold" FontSize="14px" VerticalAlignment="Center" />


                        <StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal">
                            <TextBlock Text="站点ID：" VerticalAlignment="Center" Margin="0 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="TxtFindStationId_PreviewTextInput" />
                            <zdfflatui:FlatButton Grid.Column="1" x:Name="btnQuery" HorizontalAlignment="Center"
                                              Background="#2196F3" Content="查  询"
                                                Click="BtnQuery_Click" Foreground="White"
                                              Width="80" Height="28" FontSize="14" Margin="0 0 50 0" />
                            
                            <zdfflatui:FlatButton Grid.Column="1" x:Name="btnClearAll" HorizontalAlignment="Center"
                                              Background="#FF4C4C" Content="清空站点"
                                                Click="BtnClearAll_Click" Foreground="White"
                                              Width="80" Height="28" FontSize="13" Margin="0 0 0 0" />
                            <zdfflatui:FlatButton x:Name="btnAddStation" Background="#2196F3" 
                                                  Foreground="White" Content="增加站点" 
                                                  Click="BtnAddStation_Click" 
                                              Width="80" Height="28" FontSize="13" Margin="10 0 0 0" />
                            <zdfflatui:FlatButton Grid.Column="2" x:Name="btnRefresh" HorizontalAlignment="Center"
                                              Background="#2196F3" Foreground="White" Content="🔄"
                                          ToolTip="刷新数据列表"
                                          Click="BtnRefresh_Click" Margin="10 0 10 0"
                                              Width="30" Height="28" FontSize="20px"  />
                        </StackPanel>

                    </Grid>
                </Border>

                <Border Grid.Row="1" Visibility="Visible">
                    <local:UCStationGrid x:Name="ucStationGrid" Margin="0" Padding="2" />
                </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 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="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} 页">
                                <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}"
                             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>
</UserControl>
