<UserControl x:Class="MainShell.AlgorithmCalib.View.DieFusionCalibView"
             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:MainShell.AlgorithmCalib.View"
             xmlns:mw="http://www.maxwell-gp.com/"
             xmlns:customControl="clr-namespace:MainShell.Resources.CustomControl"
             mc:Ignorable="d" 
             d:DesignHeight="800" d:DesignWidth="1200">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>

        <Style x:Key="VerifyButtonStyle" TargetType="Button" BasedOn="{StaticResource BaseRoundedButtonStyle}">
            <Setter Property="Width" Value="110"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="Margin" Value="0,0,6,0"/>
            <Setter Property="Background" Value="#2B6CB0"/>
            <Setter Property="BorderBrush" Value="#2B6CB0"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#2C5282"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#1A365D"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Background" Value="{StaticResource DisabledBackground}"/>
                    <Setter Property="Foreground" Value="{StaticResource DisabledForeground}"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="ModuleCardStyle" TargetType="Border">
            <Setter Property="Background" Value="White"/>
            <Setter Property="BorderBrush" Value="#E0E4EA"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="CornerRadius" Value="6"/>
            <Setter Property="Margin" Value="0,0,0,12"/>
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect Color="#000000" Opacity="0.06" BlurRadius="8" ShadowDepth="2"
  Direction="270"/>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="SectionHeaderTextStyle" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>

        <Style x:Key="ParamLabelStyle" TargetType="TextBlock">
            <Setter Property="Foreground" Value="#4A5568"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
        </Style>

        <Style x:Key="ParamNumberBoxStyle" TargetType="mw:NumberBox">
            <Setter Property="Width" Value="100"/>
            <Setter Property="Height" Value="28"/>
            <Setter Property="Margin" Value="6,2"/>
            <Setter Property="Minimum" Value="-99999"/>
            <Setter Property="Maximum" Value="99999"/>
            <Setter Property="DecimalPlaces" Value="3"/>
            <Setter Property="Foreground" Value="#1568D5"/>
        </Style>

        <Style x:Key="ReadOnlyNumberBoxStyle" TargetType="mw:NumberBox" BasedOn="{StaticResource
  ParamNumberBoxStyle}">
            <Setter Property="IsReadOnly" Value="True"/>
            <Setter Property="Background" Value="#F0F4F8"/>
            <Setter Property="Foreground" Value="#4A5568"/>
        </Style>

        <Style x:Key="IntParamNumberBoxStyle" TargetType="mw:IntNumberBox">
            <Setter Property="Width" Value="100"/>
            <Setter Property="Height" Value="28"/>
            <Setter Property="Margin" Value="6,2"/>
            <Setter Property="mw:NumericKeypadAttach.IsEnabled" Value="True"/>
            <Setter Property="Minimum" Value="0"/>
            <Setter Property="Maximum" Value="1000"/>
        </Style>

        <Style x:Key="SmallActionButtonStyle" TargetType="Button">
            <Setter Property="Height" Value="28"/>
            <Setter Property="Padding" Value="10,0"/>
            <Setter Property="Margin" Value="4,2"/>
            <Setter Property="FontSize" Value="11"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border x:Name="bd" Background="#EDF2F7" BorderBrush="#CBD5E0"
                                  BorderThickness="1" CornerRadius="4"
                                  Padding="{TemplateBinding Padding}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="bd" Property="Background" Value="#E2E8F0"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="bd" Property="Background" Value="#CBD5E0"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="bd" Property="Background" Value="#F7FAFC"/>
                                <Setter TargetName="bd" Property="BorderBrush" Value="#E2E8F0"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="StartButtonStyle" TargetType="Button" BasedOn="{StaticResource  BaseRoundedButtonStyle}">
            <Setter Property="Width" Value="110"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="Margin" Value="0,0,6,0"/>
            <Setter Property="Background" Value="#1A202C"/>
            <Setter Property="BorderBrush" Value="#1A202C"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#2D3748"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#0F141B"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Background" Value="{StaticResource DisabledBackground}"/>
                    <Setter Property="BorderBrush" Value="{StaticResource DisabledBackground}"/>
                    <Setter Property="Foreground" Value="{StaticResource DisabledForeground}"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="StopButtonStyle" TargetType="Button" BasedOn="{StaticResource
  BaseRoundedButtonStyle}">
            <Setter Property="Width" Value="110"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="Margin" Value="0,0,6,0"/>
            <Setter Property="Background" Value="#E53E3E"/>
            <Setter Property="BorderBrush" Value="#E53E3E"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#C53030"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#9B2C2C"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <!-- ==================== 左侧：相机预览 ==================== -->
        <Border Grid.Column="0" Margin="0,0,4,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="32"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <Border Grid.Row="0" Padding="10,0">
                    <Grid>
                        <TextBlock Text="相机预览"
                                     Foreground="#7A8FA6"
                                     FontSize="11"
                                     FontWeight="SemiBold"
                                     VerticalAlignment="Center"/>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"
  VerticalAlignment="Center">
                            <Ellipse Width="7" Height="7" Fill="#28A745" Margin="0,0,4,0"/>
                            <TextBlock Text="LIVE" Foreground="#28A745" FontSize="10" FontWeight="Bold"/>
                        </StackPanel>
                    </Grid>
                </Border>

                <ContentControl Grid.Row="1" Content="{Binding CameraAxisViewModelSevice}"/>
            </Grid>
        </Border>

        <!-- ==================== 右侧：Tab切换 ==================== -->
        <Grid Grid.Column="1">
            <TabControl>
                <!-- ====== Tab 1：标定 ====== -->
                <TabItem Header="标定">
                    <ScrollViewer VerticalScrollBarVisibility="Auto"
                                    HorizontalScrollBarVisibility="Disabled"
                                    CanContentScroll="False"
                                    PanningMode="VerticalOnly"
                                    Padding="8,8,8,0">
                        <StackPanel>

                            <!-- ====== 卡片 1：WS运动系标定位置 ====== -->
                            <Border Style="{StaticResource ModuleCardStyle}" IsEnabled="{Binding Motion.IsFinish}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="36"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <Border Grid.Row="0"
                                              Background="#F7F9FC"
                                              BorderBrush="#E0E4EA"
                                              BorderThickness="0,0,0,1"
                                              CornerRadius="6,6,0,0"
                                              Padding="10,0">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <Ellipse Width="8" Height="8" Fill="#E8821A" VerticalAlignment="Center"
                                              Margin="0,0,5,0"/>
                                            <TextBlock Text="WS运动系标定位置"
                                                         Foreground="#E8821A"
                                                         Style="{StaticResource SectionHeaderTextStyle}"/>
                                        </StackPanel>
                                    </Border>

                                    <Border Grid.Row="1" Padding="10,8">
                                        <StackPanel>
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="90"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="WS平台标定X1(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.MoveAxisPos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="80"/>
                                                <Button Grid.Column="2"
                                                          Content="移到此位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveWSCalibPosPosition}"/>
                                            </Grid>

                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="90"/>
                                                    <ColumnDefinition Width="40"/>
                                                    <ColumnDefinition Width="90"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="X2："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.ApproachXPos}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="80"/>
                                                <TextBlock Grid.Column="2"
                                                             Text="Y1："
                                                             Style="{StaticResource ParamLabelStyle}"/>
                                                <mw:NumberBox Grid.Column="3"
                                                                Value="{Binding WsFusionCalibParItem.ApproachYPos}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="80"/>
                                                <Button Grid.Column="4"
                                                          Content="中心对齐"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnApproachWSCalibPosition}"/>
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                            </Border>

                            <!-- ====== 卡片 2：相机起始位置 ====== -->
                            <Border Style="{StaticResource ModuleCardStyle}" IsEnabled="{Binding Motion.IsFinish}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="36"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <Border Grid.Row="0"
                                              Background="#F7F9FC"
                                              BorderBrush="#E0E4EA"
                                              BorderThickness="0,0,0,1"
                                              CornerRadius="6,6,0,0"
                                              Padding="10,0">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <Ellipse Width="8" Height="8" Fill="#2D3748" VerticalAlignment="Center"
                                              Margin="0,0,5,0"/>
                                            <TextBlock Text="相机起始位置"
                                                         Style="{StaticResource SectionHeaderTextStyle}"/>
                                        </StackPanel>
                                    </Border>

                                    <Border Grid.Row="1" Padding="10,8">
                                        <StackPanel>
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="CameraX(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.CameraAxisPos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="100"/>
                                                <Button Grid.Column="2"
                                                          Content="计算位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnCalculateCameraPosition}"/>
                                                <Button Grid.Column="3"
                                                          Content="读取当前位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnSetCameraPosition}"/>
                                                <Button Grid.Column="4"
                                                          Content="移到此位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveCameraPosition}"/>
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                            </Border>

                            <!-- ====== 卡片 3：WS起始位置 ====== -->
                            <Border Style="{StaticResource ModuleCardStyle}" IsEnabled="{Binding Motion.IsFinish}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="36"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <Border Grid.Row="0"
                                              Background="#F7F9FC"
                                              BorderBrush="#E0E4EA"
                                              BorderThickness="0,0,0,1"
                                              CornerRadius="6,6,0,0"
                                              Padding="10,0">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <Ellipse Width="8" Height="8" Fill="#2D3748" VerticalAlignment="Center"
                                              Margin="0,0,5,0"/>
                                            <TextBlock Text="WS起始位置"
                                                         Style="{StaticResource SectionHeaderTextStyle}"/>
                                        </StackPanel>
                                    </Border>

                                    <Border Grid.Row="1" Padding="10,8">
                                        <StackPanel>
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="100"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="StartX(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.StartX}"
                                                              Style="{StaticResource ReadOnlyNumberBoxStyle}"
                                                                Width="100"/>
                                                <TextBlock Grid.Column="2"
                                                             Text="StartY(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"/>
                                                <mw:NumberBox Grid.Column="3"
                                                                Value="{Binding WsFusionCalibParItem.StartY}"
                                                                Style="{StaticResource ReadOnlyNumberBoxStyle}"
                                                                Width="100"/>
                                            </Grid>

                                            <StackPanel Orientation="Horizontal" Margin="0,4,0,0">
                                                <Button Content="计算位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnCalculateWSPosition}"/>
                                                <Button Content="读取当前位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnSetWaferStartPosition}"/>
                                                <Button Content="移到此位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveWaferStartPosition}"/>
                                                <Button Content="对齐中心"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveToCenter}"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                            </Border>

                            <!-- ====== 卡片 4：标定参数 ====== -->
                            <Border Style="{StaticResource ModuleCardStyle}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="36"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <Border Grid.Row="0"
                                              Background="#F7F9FC"
                                              BorderBrush="#E0E4EA"
                                              BorderThickness="0,0,0,1"
                                              CornerRadius="6,6,0,0"
                                              Padding="10,0">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <Ellipse Width="8" Height="8" Fill="#2D3748" VerticalAlignment="Center"
                                              Margin="0,0,5,0"/>
                                            <TextBlock Text="标定参数"
                                                         Style="{StaticResource SectionHeaderTextStyle}"/>
                                        </StackPanel>
                                    </Border>

                                    <Border Grid.Row="1" Padding="10,8" IsEnabled="{Binding Motion.IsFinish}">
                                        <StackPanel>
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="WaferStepXY(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.CalibStep, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="100"/>
                                                <TextBlock Grid.Column="2"
                                                             Text="WaferCountXY："
                                                             Style="{StaticResource ParamLabelStyle}"/>
                                                <mw:IntNumberBox Grid.Column="3"
                                                                   Value="{Binding WsFusionCalibParItem.CalibCount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                   mw:NumericKeypadAttach.IsEnabled="True"
                                                                   Width="100"/>
                                            </Grid>

                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="StepX1(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.Step, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="100"/>
                                                <TextBlock Grid.Column="2"
                                                             Text="CountX1："
                                                             Style="{StaticResource ParamLabelStyle}"/>
                                                <mw:IntNumberBox Grid.Column="3"
                                                                   Value="{Binding WsFusionCalibParItem.Count, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                   mw:NumericKeypadAttach.IsEnabled="True"
                                                                   Minimum="1"
                                                                   Maximum="10000"
                                                                   Width="100"/>
                                            </Grid>

                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"
                                              Margin="0,8,0,0">
                                                <Button Content="开始"
                                                          Click="{mw:Action btnStart}"
                                                          Style="{StaticResource StartButtonStyle}"
                                                          IsEnabled="{Binding Motion.IsFinish}"/>
                                                <Button Content="停止"
                                                          Click="{mw:Action btnStop}"
                                                          Style="{StaticResource StopButtonStyle}"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                            </Border>

                        </StackPanel>
                    </ScrollViewer>
                </TabItem>

                <!-- ====== Tab 2：验证 ====== -->
                <TabItem Header="验证">
                    <ScrollViewer VerticalScrollBarVisibility="Auto"
                                    HorizontalScrollBarVisibility="Disabled"
                                    CanContentScroll="False"
                                    PanningMode="VerticalOnly"
                                    Padding="8,8,8,0">
                        <StackPanel>

                            <!-- ====== 卡片 1：WS运动系标定位置 ====== -->
                            <Border Style="{StaticResource ModuleCardStyle}" IsEnabled="{Binding Motion.IsFinish}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="36"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <Border Grid.Row="0"
                                              Background="#F7F9FC"
                                              BorderBrush="#E0E4EA"
                                              BorderThickness="0,0,0,1"
                                              CornerRadius="6,6,0,0"
                                              Padding="10,0">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <Ellipse Width="8" Height="8" Fill="#E8821A" VerticalAlignment="Center"
                                              Margin="0,0,5,0"/>
                                            <TextBlock Text="WS运动系验证位置"
                                                         Foreground="#E8821A"
                                                         Style="{StaticResource SectionHeaderTextStyle}"/>
                                        </StackPanel>
                                    </Border>

                                    <Border Grid.Row="1" Padding="10,8">
                                        <StackPanel>
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="180"/>
                                                    <ColumnDefinition Width="100"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="WS平台标定X1(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.MoveAxisPos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="80"/>
                                                <Button Grid.Column="2"
                                                          Content="移到此位置"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveWSCalibPosPosition}"/>
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                            </Border>

                            <!-- ====== 卡片 2：WS运动位置（验证） ====== -->
                            <Border Style="{StaticResource ModuleCardStyle}" IsEnabled="{Binding Motion.IsFinish}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="36"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>

                                    <Border Grid.Row="0"
                                              Background="#F7F9FC"
                                              BorderBrush="#E0E4EA"
                                              BorderThickness="0,0,0,1"
                                              CornerRadius="6,6,0,0"
                                              Padding="10,0">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <Ellipse Width="8" Height="8" Fill="#2D3748" VerticalAlignment="Center"
                                              Margin="0,0,5,0"/>
                                            <TextBlock Text="WS运动位置"
                                                         Style="{StaticResource SectionHeaderTextStyle}"/>
                                        </StackPanel>
                                    </Border>

                                    <Border Grid.Row="1" Padding="10,8">
                                        <StackPanel>
                                            <!-- 起点坐标 -->
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="100"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="StartX(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.WaferStartVerifyX}"
                                                                Style="{StaticResource ReadOnlyNumberBoxStyle}"
                                                                Width="100"/>
                                                <TextBlock Grid.Column="2"
                                                             Text="StartY(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"/>
                                                <mw:NumberBox Grid.Column="3"
                                                                Value="{Binding WsFusionCalibParItem.WaferStartVerifyY}"
                                                                Style="{StaticResource ReadOnlyNumberBoxStyle}"
                                                                Width="100"/>
                                            </Grid>

                                            <!-- 设置起点 -->
                                            <StackPanel Orientation="Horizontal" Margin="0,4,0,0">
                                                <Grid Margin="0,2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="150"/>
                                                        <ColumnDefinition Width="120"/>
                                                        <ColumnDefinition Width="100"/>
                                                        <ColumnDefinition Width="120"/>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>

                                                    <Button Grid.Column="1" Content="设置起点"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveToCenter}"/>
                                                    <Button Grid.Column="3"
                                                          Content="移动到起点"
                                                          Style="{StaticResource SmallActionButtonStyle}"
                                                          Click="{mw:Action btnMoveToStartPoint}"/>

                                                </Grid>

                                            </StackPanel>

                                            <!-- Step + 移动到起点 -->
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="Auto"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="Step(mm)："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:NumberBox Grid.Column="1"
                                                                Value="{Binding WsFusionCalibParItem.WaferVerityStep}"
                                                                mw:NumericKeypadAttach.IsEnabled="True"
                                                                Width="100"/>

                                            </Grid>

                                            <!-- Count X / Y -->
                                            <Grid Margin="0,2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="150"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="100"/>
                                                    <ColumnDefinition Width="120"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0"
                                                             Text="CountX："
                                                             Style="{StaticResource ParamLabelStyle}"
                                                             Margin="6,0"/>
                                                <mw:IntNumberBox Grid.Column="1"
                                                                   Value="{Binding WsFusionCalibParItem.WaferVerityCountX}"
                                                                   mw:NumericKeypadAttach.IsEnabled="True"
                                                                   Width="100"/>
                                                <TextBlock Grid.Column="2"
                                                             Text="CountY："
                                                             Style="{StaticResource ParamLabelStyle}"/>
                                                <mw:IntNumberBox Grid.Column="3"
                                                                   Value="{Binding WsFusionCalibParItem.WaferVerityCountY}"
                                                                   mw:NumericKeypadAttach.IsEnabled="True"
                                                                   Width="100"/>
                                            </Grid>

                                            <!-- 飞拍 + 验证按钮 -->
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"
                                                          Margin="0,8,0,0">
                                                <Button Content="开始飞拍"
                                                          Click="{mw:Action btnMoveWafer}"
                                                          Style="{StaticResource StartButtonStyle}"
                                                          IsEnabled="{Binding Motion.IsFinish}"/>
                                                <Button Content="以当前相机位置验证"
                                                          Click="{mw:Action btnVerityWafer}"
                                                          Style="{StaticResource VerifyButtonStyle}"
                                                          Width="150"
                                                          IsEnabled="{Binding Motion.IsFinish}"/>
                                                <Button Content="停止"
                                                          Click="{mw:Action btnStopVerityWafer}"
                                                          Style="{StaticResource StopButtonStyle}"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </Border>
                                </Grid>
                            </Border>

                        </StackPanel>
                    </ScrollViewer>
                </TabItem>
            </TabControl>
        </Grid>

        <customControl:LoadingWaitView Grid.ColumnSpan="2" Panel.ZIndex="1000"/>
    </Grid>
</UserControl>
