<Page x:Class="ThickTcpUiInWindow.Page_Curve"
      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"
      xmlns:local="clr-namespace:ThickTcpUiInWindow"   
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
      Loaded="Page_Loaded"
      Unloaded="Page_Unloaded"
      Background="White"
	Title="Page_Curve">
    <Page.Resources>
        <ResourceDictionary>
            <local:CurveTypeConverter x:Key="curvetype2boolconv" />
            <local:CurveCorrectWayConverter x:Key="curvecorrway2boolconv" />
            <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="*" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
            <Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack"/>
            <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="{DynamicResource strADCurve}"/>
        </StackPanel>
        <Grid Grid.Row="1" Margin="0,5,0,5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="784*" />
            </Grid.ColumnDefinitions>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="247*" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strCurveType}" />
                        <ComboBox Width="191" HorizontalAlignment="Left">
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource curvetype2boolconv}, ConverterParameter=E}">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strE}"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource curvetype2boolconv}, ConverterParameter=Line}">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strLinear}"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource curvetype2boolconv}, ConverterParameter=X2}" >
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strQuadraticCurve}"/>
                            </ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strCorrectionWay}" />
                        <ComboBox Width="191" HorizontalAlignment="Left">
                            <ComboBoxItem IsSelected="{Binding CorrectWay, Converter={StaticResource curvecorrway2boolconv}, ConverterParameter=OnePointIsScale}">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strScaling}"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding CorrectWay, Converter={StaticResource curvecorrway2boolconv}, ConverterParameter=OnePointIsOffset}">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strOffset}"/>
                            </ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                </StackPanel>

                <DataGrid Grid.Row="1" AutoGenerateColumns="False" Name="datagrid" Width="204" TextBlock.FontSize="18" TextBlock.FontWeight="Normal">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="AD" Binding="{Binding AD}" Width="100"/>
                        <DataGridTextColumn Header="Value" Binding="{Binding Value,Converter={StaticResource ResourceKey=thickconv}}" Width="100"/>
                    </DataGrid.Columns>
                </DataGrid>
                <StackPanel Grid.Row="2" Margin="0,5">
                    <Button Content="{DynamicResource strScaling}" Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_scale_Click"/>
                    <Button Content="{DynamicResource strApply}" Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_apply_Click" />
                </StackPanel>
                
            </Grid>
            <WindowsFormsHost Grid.Column="1" Margin="5">
                <Chr:Chart x:Name="chart1"/>
            </WindowsFormsHost>
        </Grid>
    </Grid>
</Page>
