<UserControl x:Class="MainShell.HeightMeasure.View.HeightView"
             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.HeightMeasure.View"
             xmlns:mw="http://www.maxwell-gp.com/"
             xmlns:mwControls="http://www.maxwell-gp.com/"
             xmlns:customControl="clr-namespace:MainShell.Resources.CustomControl"
             mwControls:ParameterAttach.DelayAcceptValue ="{Binding ParameterHelper}"
             mc:Ignorable="d" 
             d:DesignHeight="850" d:DesignWidth="1200">
    <UserControl.Resources>
        <Style TargetType="GroupBox" BasedOn="{StaticResource GroupStepControl}"/>
        <Style TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
            <Setter Property="HorizontalContentAlignment" Value="Right"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Height" Value="35"/>
            <Setter Property="Width" Value="80"/>
        </Style>
        <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}" >
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="Width" Value="82"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition Height="2*"/>
            <RowDefinition Height="90"/>
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <GroupBox  Header="【第一步】填写测高标定数据" Grid.Row="0">
            <GroupBox.Content>
                <StackPanel Orientation="Vertical" >
                    <StackPanel Orientation="Horizontal">
                        <Label Content="{DynamicResource DieThickness}"/>
                        <mw:NumberBox Value="{Binding HeightBaseItem.DieThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  Grid.Column="1"   HorizontalAlignment="Left"  Width="110" Height="35" />
                        <Label Content="{DynamicResource WaferThickness}" />
                        <mw:NumberBox Value="{Binding HeightBaseItem.WaferFilmThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  Grid.Column="1"   HorizontalAlignment="Left"  Width="110" Height="35" />
                        <Label  Content="{DynamicResource SubstrateThickness}"/>
                        <mw:NumberBox Value="{Binding HeightBaseItem.GlassThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  Grid.Column="1"   HorizontalAlignment="Right" Width="110" Height="35" />
                        <Label Content="{DynamicResource CarrierThickness}"/>
                        <mw:NumberBox Value="{Binding HeightBaseItem.CarrierThickness}" Margin="5" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  Grid.Column="1"   HorizontalAlignment="Right" Width="110" Height="35" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <customControl:AxisMoveControl LableContent1="{DynamicResource CZCalibrationHeight}" 
                                Value1="{Binding HeightBaseItem.CZCalibrationHeight}"
                                LableContent2="{DynamicResource StageDatumHeight}"
                                NumberBoxWidth="110"
                                Value2="{Binding HeightBaseItem.StageDatumHeight}"
                                MoveCommand="{mw:Action btnMoveCZAndStagePlatform}"/>
                       </StackPanel>
                </StackPanel>
            </GroupBox.Content>
        </GroupBox>

        <GroupBox Header="【第二步】基础位置示教" Grid.Row="1">
            <GroupBox.Content>
                <StackPanel Orientation="Vertical" >
                    <StackPanel Orientation="Horizontal">
                        <Label Content="{DynamicResource WSAvoidancePosition}" Width="120"/>
                        <mw:NumberBox DecimalPlaces="4"  Value="{Binding HeightBaseItem.AvoidancePositionX21}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
                        <mw:NumberBox DecimalPlaces="4"  Value="{Binding HeightBaseItem.AvoidancePositionY21}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
                        <Button Content="{DynamicResource ReadPosition}" Tag="龙门2避让位—读取当前位置" Click="{mw:Action btnReadAvoidancePosition}"  VerticalAlignment="Center" HorizontalAlignment="Left" Width="110"/>
                        <Button Content="{DynamicResource MovePosition}" Tag="龙门2避让位—移动到位" Click="{mw:Action btnMoveAvoidancePosition}"  VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal">
                        <Label Content="{DynamicResource LaserToCaliStage}" Grid.Column="0" Width="120"/>
                        <mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightPositionX}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
                        <mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightPositionY}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
                        <mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightPositionZ}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
                        <Button  Content="{DynamicResource ReadPosition}" Tag="激光打到对刀仪测量点—读取当前位置" Click="{mw:Action btnReadLaserToKnifePosition}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
                        <Button  Content="{DynamicResource MovePosition}" Tag="激光打到对刀仪测量点—移动到位" Click="{mw:Action btnMoveLaserToKnifePosition}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
                        <Button  Content="{DynamicResource HeightMeasure}" Tag="激光打到对刀仪测量点—高度测量" Click="{mw:Action btnHeightMeasure}" VerticalAlignment="Center" HorizontalAlignment="Right" Width="110"/>
                        <mw:NumberBox Value="{Binding DiaHeightItem.CaliZHeightLaserReading}" IsReadOnly="True" Background="LightGray" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Right" Margin="5" Width="110" Height="35" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="激光实时值" Width="120"/>
                        <mw:NumberBox Value="{Binding CurrentDiastimeterDistance}" DecimalPlaces="4" IsReadOnly="True" Background="LightGray" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left" Margin="5" Width="110" Height="35" />
                        <Button Content="开始采集" Click="{mw:Action StartDiastimeterPolling}" Width="110"/>
                        <Button Content="停止采集" Click="{mw:Action StopDiastimeterPolling}" Width="110"/>
                        <TextBlock Text="{Binding DiastimeterStatus}" VerticalAlignment="Center" Margin="8,0,0,0" Foreground="{StaticResource PrimaryTextBrush}"/>
                    </StackPanel>
                </StackPanel>
            </GroupBox.Content>
        </GroupBox>

        <GroupBox Header="【第三步】测量点位示教" Grid.Row="2">
            <UniformGrid Grid.Row="2" Columns="2">
                <GroupBox Header="{DynamicResource SubstrateHeightMeasure}" Margin="3,3,3,3" Style="{StaticResource GroupBoxSecondary}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="50"/>
                        </Grid.RowDefinitions>
                        <DataGrid Name="dataGridGlassPoint" Grid.Row="0"  ItemsSource="{Binding HeightBaseItem.GlassHeightMeasureList}" SelectedItem="{Binding SelectedGlassPoint}" Margin="3" AutoGenerateColumns="false"  SelectionMode="Single"
              CanUserSortColumns="False">
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="{DynamicResource Id}" Binding="{Binding Id}" Width="2*" IsReadOnly="true"/>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource X}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          Minimum="-100000" Maximum="100000"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource Y}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          Minimum="-100000" Maximum="100000"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource Z}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          Minimum="-100000" Maximum="100000"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource Height}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockHeight" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockHeight" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          IsReadOnly="True"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                        <UniformGrid Grid.Row="1" Columns="6">
                            <Button Content="{DynamicResource Add}" Tag="产品高度测量—添加" Click="{mw:Action BtnGlassAdd}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button Content="{DynamicResource Delete}" Tag="产品高度测量—删除" Click="{mw:Action BtnGlassDelete}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button  Content="{DynamicResource ReadPosition}" Tag="产品高度测量—读取当前位置" Click="{mw:Action btnSetPositionGlass}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button  Content="{DynamicResource MovePosition}" Tag="产品高度测量—移动到位" Click="{mw:Action btnMovePositionGlass}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button  Content="{DynamicResource HeightMeasure}" Tag="产品高度测量—高度测量" Click="{mw:Action btnTestGlassHeightGlass}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                        </UniformGrid>
                    </Grid>
                </GroupBox>
                <GroupBox Header="{DynamicResource WaferHeightMeasure}" Margin="0,3,3,3" Style="{StaticResource GroupBoxSecondary}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50"/>
                            <RowDefinition/>
                            <RowDefinition Height="50"/>
                        </Grid.RowDefinitions>
                        <StackPanel Orientation="Horizontal">
                            <customControl:AxisMoveControl LableContent1="X1:" LableWidth="35"
                                                           Value1="{Binding HeightBaseItem.MeasureWaferHeightX11}"
                                                           LableContent2="Y1:"
                                                           Value2="{Binding HeightBaseItem.MeasureWaferHeightY11}"
                                                           MoveCommand="{mw:Action btnMoveGantry1}"/>
                        </StackPanel>
                        <DataGrid Name="dataGridWaferPoint" Grid.Row="1"  ItemsSource="{Binding HeightBaseItem.WaferHeightMeasureList}" SelectedItem="{Binding SelectedWaferPoint}" Margin="3" AutoGenerateColumns="false"  SelectionMode="Single"
              CanUserSortColumns="False">
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="{DynamicResource Id}" Binding="{Binding Id}" Width="2*" IsReadOnly="true"/>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource X}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding X, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          Minimum="-100000" Maximum="100000"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource Y}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Y, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          Minimum="-100000" Maximum="100000"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource Z}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockIndex" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockIndex" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Z, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          Minimum="-100000" Maximum="100000"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn Width="3*">
                                    <DataGridTemplateColumn.Header>
                                        <TextBlock Text="{DynamicResource Height}"/>
                                    </DataGridTemplateColumn.Header>
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridCell}}, Path=IsSelected}" Value="True">
                                                    <Setter TargetName="txtBlockHeight" Property="TextBlock.Foreground" Value="White"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                            <TextBlock Name="txtBlockHeight" Foreground="{StaticResource PrimaryTextBrush}" Text="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=F4}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <mw:NumberBox mw:NumericKeypadAttach.IsEnabled="True" Width="228"  mw:BorderElement.CornerRadius="0" BorderThickness="0" Value="{Binding Height, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                          IsReadOnly="True"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                        <UniformGrid Grid.Row="2" Columns="6">
                            <Button Content="{DynamicResource Add }" Tag="方片高度测量—添加" Click="{mw:Action BtnWaferAdd}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button Content="{DynamicResource Delete}" Tag="方片高度测量—删除" Click="{mw:Action BtnWaferDelete}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button  Content="{DynamicResource ReadPosition}" Tag="方片高度测量—读取当前位置" Click="{mw:Action btnSetPositionWafer}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button  Content="{DynamicResource MovePosition}" Tag="方片高度测量—移动到位" Click="{mw:Action btnMovePositionWafer}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                            <Button  Content="{DynamicResource HeightMeasure}" Tag="方片高度测量—高度测量" Click="{mw:Action btnTestWaferHeight}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                        </UniformGrid>
                    </Grid>
                </GroupBox>
            </UniformGrid>
        </GroupBox>

        <GroupBox Header="【第四步】测高结果计算" Grid.Row="3">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="100"/>
                </Grid.ColumnDefinitions>

                <StackPanel Orientation="Vertical" Grid.Column="0" IsEnabled="False" VerticalAlignment="Center">
                    <StackPanel Orientation="Horizontal">
                        <Label Content="{DynamicResource StageBaseHeight}" Width="100"/>
                        <mw:NumberBox DecimalPlaces="4" Value="{Binding HeightBaseItem.StageDatumHeight}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Margin="5" Maximum="1000" HorizontalAlignment="Left" Width="100" Height="35" />
                        <Label Content="{DynamicResource Gap2}" Margin="5" Width="100" />
                        <mw:NumberBox DecimalPlaces="4" Value="{Binding HeightBaseItem.FromDieToPadDistance}" mw:NumericKeypadAttach.IsEnabled="True" Margin="5" Minimum="-1000" Maximum="1000" HorizontalAlignment="Left"  Width="100" Height="35" />
                        <Label Content="{DynamicResource NeedleTouchWaferZHeight}" Width="150"/>
                        <mw:NumberBox Value="{Binding  HeightBaseItem.NeedleTouchWaferZHeight}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"   HorizontalAlignment="Left" Margin="5" Width="100" Height="35" />
                        <Label Content="{DynamicResource LaserToZ1Offset}" Width="110"/>
                        <mw:NumberBox Value="{Binding DiaHeightItem.LaserToZ1Offset}" mw:NumericKeypadAttach.IsEnabled="True" Minimum="-1000" Maximum="1000"  HorizontalAlignment="Left" Margin="5" Width="100" Height="35" />
                    </StackPanel>
                </StackPanel>

                <Button Content="{DynamicResource Calculate}" Tag="计算" Grid.Column="1" Click="{mw:Action BtnCalculateHeight}" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Grid>
        </GroupBox>
        
        <Border
        Grid.Row="4"
        Background="{StaticResource SecondaryLightBrush}"
        BorderBrush="{StaticResource BorderBrush}"
        BorderThickness="2,0,2,2">
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Content="{DynamicResource Save}" Tag="保存" Click="{mw:Action btnSave}" Height="35" Grid.Row="1" Grid.Column="4"  Margin="5"  IsEnabled="{Binding Motion.IsFinish}"/>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
