<Page x:Class="FLY.Thick.Base.UI.PgCurve"
      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:FLY.Thick.Base.UI"   
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
      Background="WhiteSmoke"
	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:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
                <!--<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;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="AD曲线"/>
        </StackPanel>
        <Grid Grid.Row="1" >
            <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>
                    <StackPanel Margin="{StaticResource ControlMargin}">
                        <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="曲线类型" />
                        <ComboBox Width="191" HorizontalAlignment="Left">
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource curvetype2boolconv}, ConverterParameter=E}">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="自然对数E"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource curvetype2boolconv}, ConverterParameter=Line}">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="线性"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource curvetype2boolconv}, ConverterParameter=X2}" >
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="2次曲线"/>
                            </ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                    <StackPanel Margin="{StaticResource ControlMargin}">
                        <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="修正方式" />
                        <ComboBox Width="191" HorizontalAlignment="Left">
                            <ComboBoxItem IsSelected="{Binding CorrectWay, Converter={StaticResource curvecorrway2boolconv}, ConverterParameter=OnePointIsScale}">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="缩放"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding CorrectWay, Converter={StaticResource curvecorrway2boolconv}, ConverterParameter=OnePointIsOffset}">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="平移"/>
                            </ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                </StackPanel>

                <DataGrid Grid.Row="1" AutoGenerateColumns="False" Width="204" TextBlock.FontSize="18" TextBlock.FontWeight="Normal" ItemsSource="{Binding Curves}">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="AD" Binding="{Binding AD}" Width="100"/>
                        <DataGridTextColumn Header="Value" Binding="{Binding Value,Converter={StaticResource thickconv}}" Width="100"/>
                    </DataGrid.Columns>
                </DataGrid>
                <StackPanel Grid.Row="2" Margin="0,5">
                    <Button Content="缩放" Style="{StaticResource ButtonStyle2}" Command="{Binding ScaleCmd}"/>
                    <Button Content="应用" Style="{StaticResource ButtonStyle2}" Command="{Binding ApplyCmd}" />
                </StackPanel>
                
            </Grid>
            <WindowsFormsHost Grid.Column="1" Margin="{StaticResource ControlMargin}">
                <Chr:Chart x:Name="chart1"/>
            </WindowsFormsHost>
        </Grid>
    </Grid>
</Page>
