<Page x:Class="CCDCountWpf.WpfPage.MainPage"
      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:CCDCountWpf.WpfPage"
      xmlns:BindNameSpace="clr-namespace:CCDCountWpf"
      mc:Ignorable="d"
      Title="MainPage" Height="1000" Width="1920" Loaded="Page_Loaded">

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="380"/>
        </Grid.ColumnDefinitions>
        <Grid Margin="0,0,0,240">
            <Border BorderBrush="Black" BorderThickness="1" Margin="2,2,2,2">
                <Image x:Name="ShowBox"  Source="{Binding BitmapImage}" Margin="0,0,0,0"/>
            </Border>
        </Grid>

        <Border BorderBrush="Black" BorderThickness="1" Height="240" VerticalAlignment="Bottom" Padding="0,0,0,5" Margin="2,2,2,2">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.85*"/>
                    <ColumnDefinition Width="0.85*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Column="0" 
                    Background="#FF0087FF" 
                    CornerRadius="8"
                    BorderBrush="Gray"
                    BorderThickness="1"
                    Margin="5,10,5,0" Height="218" VerticalAlignment="Top" Cursor="">
                    <Grid>
                        <StackPanel Orientation="Vertical" Margin="0,0,80,0">
                            <StackPanel Orientation="Horizontal">
                                <Label  Content="总粒数：" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" FontSize="20" Foreground="White"/>
                                <Label x:Name="AllActiveNumLab" Content="{Binding AllActiveNum}" HorizontalAlignment="Left" Margin="20,10,0,0"  Width="80" FontWeight="Bold" FontSize="20"  Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <Label  Content="合格数：" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" FontSize="20" Foreground="White"/>
                                <Label x:Name="AllOkNumLab" Content="{Binding AllOkNum}" HorizontalAlignment="Left" Margin="20,10,0,0" Width="80" FontWeight="Bold" FontSize="20" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <Label  Content="不合格数：" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" FontSize="20" Foreground="White"/>
                                <Label x:Name="AllNgNumLab" Content="{Binding AllNgNum}" HorizontalAlignment="Left" Margin="0,10,0,0" Width="80" FontWeight="Bold" FontSize="20" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <Label  Content="装瓶数：" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" FontSize="20" Foreground="White"/>
                                <Label  Content="{Binding BottingCount}" HorizontalAlignment="Left" Margin="20,10,0,0" Width="80" FontWeight="Bold" FontSize="20" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White"/>
                            </StackPanel>
                        </StackPanel>
                        <Label x:Name="CamRunStaticLab" Content="{Binding CamRunStatic}" HorizontalAlignment="Right" Margin="10,5,10,0" VerticalAlignment="Top" Background="{x:Null}" FontSize="25" Foreground="{Binding CameraStaticColor}" FontWeight="Bold" />
                        <Button x:Name="DataClear" Content="清零" BorderThickness="1" HorizontalAlignment="Right" Margin="10,0,10,12" Width="80" Height="40" Background="#FF0123FF" FontWeight="Bold" FontSize="20" Foreground="White" Click="DataClear_Click" Cursor="Hand" VerticalAlignment="Bottom">
                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <Border CornerRadius="5" 
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                    </Border>
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                    </Grid>
                    <!-- 卡片内容 -->
                </Border>

                <Border Grid.Column="1" 
                    Background="#FF0087FF" 
                    CornerRadius="8"
                    BorderBrush="Gray"
                    BorderThickness="1"
                    Margin="5,10,5,0" Height="60" VerticalAlignment="Top">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <Label  Content="计数速度：" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" FontSize="20" Foreground="White"/>
                        <Label x:Name="ShuLiSpeedTbx" Content="{Binding ShuLiSpeed}" HorizontalAlignment="Left" Margin="0,0,0,0" Width="60" FontWeight="Bold" FontSize="20" Background="{x:Null}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White"/>
                        <Label Content="粒/秒" FontWeight="Bold" FontSize="20" Margin="0,10,0,0" Foreground="White" />
                    </StackPanel>
                </Border>
                <Border Grid.Column="1" 
                    Background="#FF0087FF" 
                    CornerRadius="8"
                    BorderBrush="Gray"
                    BorderThickness="1"
                    Margin="5,75,5,0" Height="153" VerticalAlignment="Top">
                    <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                            <TextBlock Text="生产批次:" FontSize="20" Margin="0,0,20,0" VerticalAlignment="Center" Foreground="White"/>
                            <TextBox x:Name="BatchNumberTbx" Text="{Binding Source={x:Static BindNameSpace:ShowMessageBus.ShowBinding},Path = BatchNumber,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" FontSize="16" Width="160" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="{x:Null}" Foreground="White" KeyDown="TextBox_KeyDown" Height="45"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
                            <Button x:Name="StartIdentifyBtn" Content="开始" BorderThickness="1" HorizontalAlignment="Right" Margin="0,0,20,0" VerticalAlignment="Top" Width="100" Height="60" Background="#FF0123FF" FontWeight="Bold" FontSize="20" Foreground="White" Cursor="Hand" Click="StartIdentifyBtn_Click">
                                <Button.Template>
                                    <ControlTemplate TargetType="Button">
                                        <Border CornerRadius="5"  Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"  BorderThickness="{TemplateBinding BorderThickness}">
                                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Border>
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>
                            <Button x:Name="StopIdentifyBtn" Content="暂停" BorderThickness="1" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Top" Width="100" Height="60" Background="#FF0123FF" FontWeight="Bold" FontSize="20" Foreground="White" Cursor="Hand" Click="StopIdentifyBtn_Click">
                                <Button.Template>
                                    <ControlTemplate TargetType="Button">
                                        <Border CornerRadius="5"  Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"  BorderThickness="{TemplateBinding BorderThickness}">
                                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Border>
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                </Border>

                <Border Grid.Column="2" 
                    Background="#FF0087FF" 
                    CornerRadius="8"
                    BorderBrush="Gray"
                    BorderThickness="1"
                    Margin="5,10,5,0" Height="218" VerticalAlignment="Top" Cursor="">
                    <Grid>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Label Content="当前配方：" FontWeight="Bold" FontSize="20" Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                <TextBox x:Name="FormulationName" Text="{Binding FormulationName,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" Width="140" Height="40"  Foreground="White" Background="{x:Null}" KeyDown="TextBox_KeyDown" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"></TextBox>
                                <Button x:Name="SaveFormulationBtn" Content="保存配方" BorderThickness="1" HorizontalAlignment="Center" Margin="20,0,0,0" VerticalAlignment="Center" Width="110" Height="50" Background="#FF0123FF" FontWeight="Bold" FontSize="20" Foreground="White" Cursor="Hand" Click="SaveFormulationBtn_Click">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5"  Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"  BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="0,15,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Label Content="选择配方：" FontWeight="Bold" FontSize="20" Margin="10,0,0,0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                <ComboBox  x:Name="FormulationCoBox" Height="40" Width="140" ItemsSource="{Binding FormulationItems}" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" FontSize="20">
                                    <ComboBox.Template>
                                        <ControlTemplate TargetType="ComboBox">
                                            <Grid>
                                                <ToggleButton
                                                    Foreground="White"
                                                    IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
                                                    ClickMode="Press">
                                                    <ToggleButton.Template>
                                                        <ControlTemplate TargetType="ToggleButton">
                                                            <Border x:Name="Border" Background="#FF0087FF" BorderBrush="#FFABADB3" BorderThickness="1">
                                                                <Grid>
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition />
                                                                        <ColumnDefinition Width="20" />
                                                                    </Grid.ColumnDefinitions>
                                                                    <ContentPresenter Grid.Column="0" Margin="3" />
                                                                    <Path x:Name="Arrow" Grid.Column="1" 
                                                                    Fill="White"
                                                                    HorizontalAlignment="Center" 
                                                                    VerticalAlignment="Center"
                                                                    Data="M 0 0 L 4 4 L 8 0 Z" />
                                                                </Grid>
                                                            </Border>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True">
                                                                    <Setter TargetName="Border" Property="Background" Value="LightBlue" />
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </ToggleButton.Template>
                                                </ToggleButton>
                                                <ContentPresenter x:Name="ContentSite" 
                                                    IsHitTestVisible="False"
                                                    Content="{TemplateBinding SelectionBoxItem}"
                                                    ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                                    Margin="3,3,23,3"
                                                    VerticalAlignment="Center"
                                                    HorizontalAlignment="Left" 
                                                    TextBlock.Foreground="White"/>
                                                <Popup x:Name="Popup" 
                                                    Placement="Bottom"
                                                    IsOpen="{TemplateBinding IsDropDownOpen}"
                                                    AllowsTransparency="True" 
                                                    Focusable="False"
                                                    PopupAnimation="Slide">
                                                    <Border x:Name="DropDownBorder" 
                                                         Background="#FF0087FF"
                                                         BorderBrush="#FF0087FF"
                                                         BorderThickness="1">
                                                        <ScrollViewer Margin="0,3,0,3" 
                                                            SnapsToDevicePixels="True">
                                                            <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" />
                                                        </ScrollViewer>
                                                    </Border>
                                                </Popup>
                                            </Grid>
                                        </ControlTemplate>
                                    </ComboBox.Template>

                                    <ComboBox.ItemContainerStyle>
                                        <Style TargetType="ComboBoxItem">
                                            <Setter Property="Background" Value="#FF0087FF" />
                                            <Setter Property="Foreground" Value="White" />
                                            <Style.Triggers>
                                                <Trigger Property="IsHighlighted" Value="True">
                                                    <Setter Property="Background" Value="LightBlue" />
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </ComboBox.ItemContainerStyle>
                                </ComboBox>
                                <Button x:Name="ReadFormulationBtn" Content="读取配方" BorderThickness="1" HorizontalAlignment="Center" Margin="20,0,0,0" VerticalAlignment="Center" Width="110" Height="50" Background="#FF0123FF" FontWeight="Bold" FontSize="20" Foreground="White" Cursor="Hand" Click="ReadFormulationBtn_Click">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5"  Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"  BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                        </StackPanel>
                            
                    </Grid>
                </Border>
            </Grid>
        </Border>

        <Border Grid.Column="1" BorderBrush="Black" BorderThickness="1" Margin="2,2,2,2">
            <Border Background="#FF0087FF" 
                    CornerRadius="8"
                    BorderBrush="Gray"
                    BorderThickness="1"
                    Margin="15,10,15,10" Cursor="">
                <Grid>
                    <ScrollViewer VerticalScrollBarVisibility="Auto">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal" Margin="0,10,0,0" HorizontalAlignment="Center">
                                <TextBlock Text="A速度:" FontSize="20" Margin="0,0,0,0" VerticalAlignment="Center" Foreground="White"/>
                                <Button x:Name="BottingMaterialCylinderVibrationTableHighSpeedValueUpUPBtn" Content="++" Width="45" Height="45" Click="BottingMaterialCylinderVibrationTableHighSpeedValueUpUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottingMaterialCylinderVibrationTableHighSpeedValueUpBtn" Content="+" Width="45" Height="45" Click="BottingMaterialCylinderVibrationTableHighSpeedValueUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <TextBox Text="{Binding Source={x:Static BindNameSpace:PlcSettingMessageBus.PlcMessageShowBindage},Path = ShakeTable1H_FillingSpeed,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" FontSize="16" Width="79" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" Background="{x:Null}" KeyDown="TextBox_KeyDown"/>
                                <Button x:Name="BottingMaterialCylinderVibrationTableHighSpeedValueDownBtn" Content="-" Width="45" Click="BottingMaterialCylinderVibrationTableHighSpeedValueDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottingMaterialCylinderVibrationTableHighSpeedValueDownDownBtn" Content="--" Width="45" Click="BottingMaterialCylinderVibrationTableHighSpeedValueDownDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                             Background="{TemplateBinding Background}"
                                             BorderBrush="{TemplateBinding BorderBrush}"
                                             BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="0,20,0,0" HorizontalAlignment="Center">
                                <TextBlock Text="B速度:" FontSize="20" Margin="0,0,0,0" VerticalAlignment="Center" Foreground="White"/>
                                <Button x:Name="BottingFilterVibrationTableHighSpeedValueUpUpBtn" Content="++" Width="45" Height="45" Click="BottingFilterVibrationTableHighSpeedValueUpUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottingFilterVibrationTableHighSpeedValueUpBtn" Content="+" Width="45" Height="45" Click="BottingFilterVibrationTableHighSpeedValueUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <TextBox Text="{Binding Source={x:Static BindNameSpace:PlcSettingMessageBus.PlcMessageShowBindage},Path = ShakeTable2H_FillingSpeed,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" FontSize="16" Width="80" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" Background="{x:Null}" KeyDown="TextBox_KeyDown"/>
                                <Button x:Name="BottingFilterVibrationTableHighSpeedValueDownBtn" Content="-" Width="45" Click="BottingFilterVibrationTableHighSpeedValueDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                             Background="{TemplateBinding Background}"
                                             BorderBrush="{TemplateBinding BorderBrush}"
                                             BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottingFilterVibrationTableHighSpeedValueDownDownBtn" Content="--" Width="45" Click="BottingFilterVibrationTableHighSpeedValueDownDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                             Background="{TemplateBinding Background}"
                                             BorderBrush="{TemplateBinding BorderBrush}"
                                             BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="0,20,0,0" HorizontalAlignment="Center">
                                <TextBlock Text="C速度:" FontSize="20" Margin="0,0,0,0" VerticalAlignment="Center" Foreground="White"/>
                                <Button x:Name="BottingCountVibrationTableHighSpeedValueUpUpBtn" Content="++" Width="45" Height="45" Click="BottingCountVibrationTableHighSpeedValueUpUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottingCountVibrationTableHighSpeedValueUpBtn" Content="+" Width="45" Height="45" Click="BottingCountVibrationTableHighSpeedValueUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <TextBox Text="{Binding Source={x:Static BindNameSpace:PlcSettingMessageBus.PlcMessageShowBindage},Path = ShakeTable3H_FillingSpeed,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" FontSize="16" Width="80" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="{x:Null}" Foreground="White" KeyDown="TextBox_KeyDown"/>
                                <Button x:Name="BottingCountVibrationTableHighSpeedValueDownBtn" Content="-" Width="45" Click="BottingCountVibrationTableHighSpeedValueDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottingCountVibrationTableHighSpeedValueDownDownBtn" Content="--" Width="45" Click="BottingCountVibrationTableHighSpeedValueDownDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="0,20,0,0" HorizontalAlignment="Center">
                                <TextBlock Text="罐装值:" FontSize="20" Margin="0,0,0,0" VerticalAlignment="Center" Foreground="White"/>
                                <Button x:Name="BottValueSetUpUpBtn" Content="++" Width="45" Height="45" Click="BottValueSetUpUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottValueSetUpBtn" Content="+" Width="45" Height="45" Click="BottValueSetUpBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <TextBox Text="{Binding Source={x:Static BindNameSpace:PlcSettingMessageBus.PlcMessageShowBindage},Path = BottValueSet,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" FontSize="16" Width="80" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="{x:Null}" Foreground="White" KeyDown="TextBox_KeyDown"/>
                                <Button x:Name="BottValueSetDownBtn" Content="-" Width="45" Click="BottValueSetDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Button x:Name="BottValueSetDownDownBtn" Content="--" Width="45" Click="BottValueSetDownDownBtn_Click" Background="#FF0123FF" Foreground="White" FontSize="20" Cursor="Hand">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Border CornerRadius="5" 
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </StackPanel>
                        </StackPanel>
                    </ScrollViewer>
                </Grid>
            </Border>
        </Border>

    </Grid>
</Page>
