<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="ShanghaiEnvironmentalTechnology.Window1"
        Title="{DynamicResource WindowTitle1}" 
       WindowState="Maximized"   Height="768" Width="1024" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">

    <Window.Resources>
        <Style x:Key="MyButtonStyle" TargetType="{x:Type 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="{x:Type 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="{x:Type 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="{x:Type 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="{x:Type TextBlock}">
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Margin" Value="5"/>
        </Style>



    </Window.Resources>

    <Grid Margin="20">
        <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="800">
            <TextBlock Text="{DynamicResource WindowTitle1}" 
                       FontSize="36" 
                       FontWeight="Bold" 
                       HorizontalAlignment="Center" 
                       Margin="0,0,0,20"/>

            <TextBlock Text="{DynamicResource RealTimeDisplay}" 
                       HorizontalAlignment="Center" 
                       Margin="0,0,0,30"/>

            <StackPanel Orientation="Vertical" Margin="0,0,0,20">
                <StackPanel Orientation="Horizontal" Margin="0,10" Width="550">
                    <TextBlock Text="{DynamicResource CurrentTest}" VerticalAlignment="Center" Foreground="Black"/>

                    <TextBox x:Name="SettingPaTextBox" Width="120" Margin="10,0" Style="{StaticResource MyTextBoxStyle}"                         
        IsReadOnly="True"
                             InputScope="Number"    PreviewTextInput="SettingPaTextBox_PreviewTextInput"  />

                    <TextBlock Text="pa" VerticalAlignment="Center" Foreground="Black"/>
                    <Button Name="btnsetting" Content="{DynamicResource Setting}" Style="{StaticResource MyButtonStyle}" Click="SettingPaTextBox_MouseLeave"/>
                    <!--<Button Content="确定" Style="{StaticResource MyButtonStyle}"/>-->
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,10" Width="554">
                    <TextBlock Text="{DynamicResource RealTimePressure}" VerticalAlignment="Center" Foreground="Black"/>
                    <TextBox x:Name="RealTimePressureTextBox" Width="120" Margin="10,0" Style="{StaticResource MyTextBoxStyle}" IsReadOnly="True" IsEnabled="True"/>
                    <TextBlock Text="pa" VerticalAlignment="Center"  Foreground="Black"/>
                    <Button Name="btnjiaozhun" Content="{DynamicResource TriggerDisplacement}" Width="180" Style="{StaticResource MyButtonStyle}" Click="Button_Click"/>
                </StackPanel>
            </StackPanel>

            <StackPanel Orientation="Vertical" Margin="0,20">
                <StackPanel Orientation="Horizontal" Margin="0,10" Width="504">
                    <TextBlock Text="{DynamicResource CurrentPosition}" VerticalAlignment="Center" Foreground="Black"/>
                    <TextBlock   x:Name="txtFolw" Text="???" Margin="10,0" VerticalAlignment="Center" Foreground="Black"/>
                    <TextBlock Text="L/min" VerticalAlignment="Center" Foreground="Black"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,10" Width="552">
                    <Button Content="{DynamicResource EndDisplacement}" Width="150" Style="{StaticResource MyButtonStyle}" Click="Button_Click_4"/>
                    <TextBlock x:Name="saveFlowTxt" Text="???" Margin="10,0" VerticalAlignment="Center" Foreground="Black"/>
                    <TextBlock Text="L/min" VerticalAlignment="Center" Foreground="Black"/>
                </StackPanel>
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,30">
                <Button Content="{DynamicResource Deformation}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_1"/>
                <Button x:Name="TestStartButton" Content="{DynamicResource Maximumforcevaluetestresult(N)}" Style="{StaticResource MyButtonStyle}"  Click="Button_Click_2"/>
                <Button Content="{DynamicResource Deformation test results}" Style="{StaticResource MyButtonStyle}" Click="Button_Click_3" />
                <Button Content="{DynamicResource ViewReport}" Width="150" Style="{StaticResource MyButtonStyle}" Click="Button_Click_5" />
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>
