<Window x:Class="ShanghaiEnvironmentalTechnology.Window3"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{DynamicResource Deformation10}" WindowState="Maximized"   Height="768" Width="1024"
        Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">

    <Window.Resources>
        <!-- 现有样式保持不变 -->
        <Style x:Key="MyButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="#4A90E2"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="Margin" Value="10"/>
            <Setter Property="Padding" Value="10,5"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Height" Value="40"/>
            <Setter Property="Width" Value="120"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Background="{TemplateBinding Background}" CornerRadius="20">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#3A7BBE"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#2A5E9A"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="MyTextBoxStyle" TargetType="TextBox">
            <Setter Property="Background" Value="#FFFFFF"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="BorderBrush" Value="#4A90E2"/>
            <Setter Property="BorderThickness" Value="2"/>
            <Setter Property="Padding" Value="10,10"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Height" Value="50"/>
            <Setter Property="Width" Value="120"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Border Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                CornerRadius="20">
                            <ScrollViewer x:Name="PART_ContentHost"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="TextBlock">
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Margin" Value="5"/>
        </Style>

        <Style x:Key="MyComboBoxStyle" TargetType="ComboBox">
            <Setter Property="Background" Value="#FFFFFF"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="BorderBrush" Value="#4A90E2"/>
            <Setter Property="BorderThickness" Value="2"/>
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="Height" Value="40"/>
            <Setter Property="Width" Value="150"/>
            <Setter Property="Margin" Value="10"/>
            <Setter Property="Padding" Value="5"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ComboBox">
                        <Border Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                CornerRadius="5">
                            <Grid>
                                <ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                              Focusable="False"
                                              ClickMode="Press">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="20"/>
                                        </Grid.ColumnDefinitions>
                                        <ContentPresenter HorizontalAlignment="Left" 
                                                          VerticalAlignment="Center" 
                                                          Margin="5,0,0,0"
                                                          Content="{TemplateBinding SelectionBoxItem}"
                                                          ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                                          ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
                                        <Path Grid.Column="1"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              Data="M 0 0 L 4 4 L 8 0 Z"
                                              Fill="Black"/>
                                    </Grid>
                                </ToggleButton>
                                <Popup IsOpen="{TemplateBinding IsDropDownOpen}"
                                       Placement="Bottom"
                                       AllowsTransparency="True"
                                       Focusable="False"
                                       PopupAnimation="Slide">
                                    <Grid MinWidth="{TemplateBinding ActualWidth}"
                                          MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                        <Border Background="White"
                                                BorderBrush="#4A90E2"
                                                BorderThickness="2"
                                                CornerRadius="5"/>
                                        <ScrollViewer Margin="1">
                                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        </ScrollViewer>
                                    </Grid>
                                </Popup>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>

    <Grid Margin="20">
        <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center">
            <TextBlock Text="{DynamicResource Deformation8}" FontSize="24" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,20"/>

            <ComboBox x:Name="CaptureModeComboBox" 
                      Style="{StaticResource MyComboBoxStyle}" 
                      HorizontalAlignment="Center" 
                      SelectionChanged="CaptureModeComboBox_SelectionChanged">
                <ComboBoxItem  Content="{DynamicResource Deformation9}" IsEnabled="False"/>
                <ComboBoxItem Content="{DynamicResource TestSpeedLabel}" IsSelected="True"/>
                <ComboBoxItem Content="{DynamicResource SetPressureLabel}"/>
            </ComboBox>

            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="0,10">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,5">
                    <TextBlock Text="{DynamicResource It has been crushed}" FontWeight="Bold" Margin="0,10,10,0"/>
                    <TextBox Name="SettingPaTextBox" Style="{StaticResource MyTextBoxStyle}" 
                                                   
                       IsReadOnly="True"
                             InputScope="Number"    
                             PreviewTextInput="SettingPaTextBox_PreviewTextInput"/>
                    <TextBlock Text=" pa" VerticalAlignment="Center"/>
                    <Button Name="btnsetting" Content="{DynamicResource The force value determines the pressure difference}" Style="{StaticResource MyButtonStyle}" Margin="10"  Click="Button_Click_10"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,5">
                    <TextBlock Text="{DynamicResource TestSpeed}" FontWeight="Bold" Margin="0,10,10,0"/>
                    <TextBox Name="clostTxt" Style="{StaticResource MyTextBoxStyle}"
                     IsReadOnly="True"
                              PreviewTextInput="ClostTxt_PreviewTextInput"
                         
                             />
                    <TextBlock Text=" pa" VerticalAlignment="Center"/>
                    <Button   Name="btnsetting2" Content="{DynamicResource The force value determines the pressure difference}" Style="{StaticResource MyButtonStyle}" Margin="10"  Click="Button_Click_11"/>
                </StackPanel>
            </StackPanel>

            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="0,20">
                <StackPanel Orientation="Horizontal" Width="Auto" HorizontalAlignment="Center">
                    <TextBlock Text="{DynamicResource TestDisplacement}" FontWeight="Bold" Width="220" TextAlignment="Right"/>
                    <TextBlock x:Name="recordOpenTxt" Text="???" FontSize="20" Foreground="Red" VerticalAlignment="Center" Margin="0,0" Width="100" TextAlignment="Center"/>
                    <TextBlock Text=" pa" VerticalAlignment="Center"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Width="Auto" HorizontalAlignment="Center">
                    <TextBlock Text="{DynamicResource TriggerValue}" FontWeight="Bold" Width="220" TextAlignment="Right"/>
                    <TextBlock Name="recordCloseTxt" Text="???" FontSize="20" Foreground="Red" VerticalAlignment="Center" Margin="0,0" Width="100" TextAlignment="Center"/>
                    <TextBlock Text=" pa" VerticalAlignment="Center"/>
                </StackPanel>
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10">
                <Button Content="{DynamicResource SetPressure}" Style="{StaticResource MyButtonStyle}" Width="220" Margin="10"  Click="Button_Click_3" Visibility="Collapsed"/>
                <Button Content="{DynamicResource ResetDistance}" Style="{StaticResource MyButtonStyle}" Width="220" Margin="10" Click="Button_Click_9" Visibility="Collapsed"/>
            </StackPanel>

            <StackPanel Margin="0,10,0,0">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,5">
                    <TextBlock Text="{DynamicResource RealTimePressure}" FontWeight="Bold"/>
                    <TextBlock x:Name="TimerPressTxt" Text="???" FontSize="20" Foreground="Red"/>
                    <TextBlock Text=" pa" VerticalAlignment="Center"/>
                </StackPanel>
                <Button Name="btnjiaozhun" Content="{DynamicResource Calibration}" Style="{StaticResource MyButtonStyle}" Margin="10,0" Click="Button_Click_4"/>
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,30">
                <Button Content="{DynamicResource Deformation}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_5"/>
                <Button Name="TestStartButton" Content="{DynamicResource Maximumforcevaluetestresult(N)}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_7"/>
                <Button Content="{DynamicResource Deformation test results}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_8"/>
                <Button Content="{DynamicResource ViewReport}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_6"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>
