<Page x:Class="ThickTcpUiInWindow.Page_BorderSearch"
      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:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
      mc:Ignorable="d" 
      d:DesignHeight="727" d:DesignWidth="981"
      Loaded="Page_Loaded" Unloaded="Page_Unloaded" 
      Background="White"
	Title="Page_BorderSearch">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Converter/Dictionary_MyConv.xaml"/>
                <!--<ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Culture/StringResource.zh-CN.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
        </Grid.RowDefinitions>
        <Grid Name="grid_null"/>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
            <Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack" />
            <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="{DynamicResource strBorderSearch}"/>
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="496*" />
            </Grid.RowDefinitions>
            <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Button Style="{StaticResource ResourceKey=ButtonStyle3}" Width="150" Margin="0,5,5,5" Click="button_apply_Click" >
                    <StackPanel Orientation="Vertical">
                        <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strParam}"/>
                        <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strApply}"/>
                    </StackPanel>
                </Button>
                <StackPanel Grid.Column="1" Orientation="Vertical">

                    <StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding DataContext.HasHold, ElementName=grid_null, Converter={StaticResource visbilityconv}, ConverterParameter=Collapsed}">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strValidRange}" />
                        <StackPanel Orientation="Horizontal">
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Valid.Begin}" />
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="-"/>
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Valid.End}" MinWidth="30" MaxWidth="120"/>
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Valid.Begin" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                            <Run Text="-"/>
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Valid.End" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                            </TextBlock>
                        </StackPanel>

                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                            <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Enable}" HorizontalAlignment="Left"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strInflectionPoint}" />
                            <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding IsBreakDetect}" HorizontalAlignment="Left"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSetTemperature}" />
                            <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding TempADBySet}" HorizontalAlignment="Left"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding TempADBySet, Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=CollapsedWhenTrue}">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strTemperatureAD}" />
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="{Binding TempAD}" />
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding TempADBySet, Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTemperatureAD}" />
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding TempAD}" />
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTemperatureRange}" />
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding TempRange}" />
                        </StackPanel>
                    </StackPanel>
                    <WrapPanel Orientation="Horizontal">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strFilter}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding N}" />
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F1}">
                                    <Binding Path="N" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>


                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSensorWidth}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding SensorWidth}" />
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F1}">
                                        <Binding Path="SensorWidth" />
                                        <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                    </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>


                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strBorderLessen}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding N2}" />
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F1}">
                                        <Binding Path="N2" />
                                        <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                    </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>


                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strBorderEnlarge}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding N3}" />
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F1}">
                                        <Binding Path="N3" />
                                        <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                    </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>


                        </StackPanel>
                    </WrapPanel >
                </StackPanel >


            </Grid>
            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <Border  Width="150" Background="{StaticResource Color_theme_activity}" Margin="0,5,5,5">
                    <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strResult}"/>
                </Border>
                <Grid Grid.Column="1" Margin="5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <WrapPanel Grid.Column="1" Orientation="Horizontal">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strForwBorder}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}">
                        <Run Text="{Binding Border_Forw.Begin, Converter={StaticResource ResourceKey=intconv}, Mode=OneWay}"/>
                        <Run Text="-"/>
                        <Run Text="{Binding Border_Forw.End, Converter={StaticResource ResourceKey=intconv}, Mode=OneWay}"/>
                                </TextBlock>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run>
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Border_Forw.Begin" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                            <Run Text="-"/>
                            <Run>
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Border_Forw.End" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>

                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strBackwBorder}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}">
                        <Run Text="{Binding Border_Backw.Begin, Converter={StaticResource ResourceKey=intconv}, Mode=OneWay}"/>
                        <Run Text="-"/>
                        <Run Text="{Binding Border_Backw.End, Converter={StaticResource ResourceKey=intconv}, Mode=OneWay}"/>
                                </TextBlock>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run>
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Border_Backw.Begin" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                            <Run Text="-"/>
                            <Run>
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Border_Backw.End" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>

                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strFilmWidth}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}">
                                <Run Text="{Binding Width,Mode=OneWay}"/>
                                </TextBlock>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"/>
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                            <Run >
                                <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                    <Binding Path="Width" />
                                    <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                </TextBlock>
                            </StackPanel>

                        </StackPanel>
                    </WrapPanel>
                    <WindowsFormsHost Grid.Row="1" Margin="5">
                        <Chr:Chart x:Name="chart1"/>
                    </WindowsFormsHost>
                </Grid>


            </Grid>
        </Grid>

    </Grid>
</Page>
