<Page x:Class="FLY.Thick.Base.UI.UiModule.PgFixAnalyze"
      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:FLY.Thick.Base.UI.UiModule"
      xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Background="White"
      Title="Page_FixAnalyze">
    <Page.Resources>
        <ResourceDictionary>
            <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.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <lvc:CartesianChart Grid.Column="1" Hoverable="False" DisableAnimations="True" DataTooltip="{x:Null}" Margin="10" MouseDown="UIElement_OnMouseDown">
                <lvc:CartesianChart.Series>
                    <lvc:LineSeries 
                        Values="{Binding Values}"
                        StrokeThickness = "3"
                        
                        Stroke = "{StaticResource Color_theme_static}"
                        Fill = "Transparent"
                    PointGeometry ="{x:Null}"
                        />
                </lvc:CartesianChart.Series>
                <lvc:CartesianChart.AxisX>
                    <lvc:Axis FontSize="16" Title="频率 Hz" LabelFormatter="{Binding XFormatter}"
                          MaxValue="{Binding XMax}"
                          MinValue="{Binding XMin}">
                        <lvc:Axis.Separator>
                            <lvc:Separator Stroke="LightGray"/>
                        </lvc:Axis.Separator>
                        <lvc:Axis.Sections>
                            <lvc:AxisSection Value="{Binding XPointer}"
                                         DataLabel="True"
                                         StrokeThickness="1"
                                         Stroke="#ff5722"
                                         DisableAnimations="True"
                                         DataLabelForeground="White"
                                         Panel.ZIndex="1"/>
                        </lvc:Axis.Sections>
                    </lvc:Axis>
                </lvc:CartesianChart.AxisX>
                <lvc:CartesianChart.AxisY>
                    <lvc:Axis Title="幅值" MaxValue="{Binding YMax}"
                          MinValue="{Binding YMin}">
                        <lvc:Axis.Separator>
                            <lvc:Separator StrokeThickness="1" Stroke="LightGray" />
                        </lvc:Axis.Separator>
                    </lvc:Axis>
                </lvc:CartesianChart.AxisY >
            </lvc:CartesianChart>
            <Grid Grid.Column="1" Grid.Row="1" Margin="10,0,10,10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal">
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="X轴最小" />
                        <StackPanel Orientation="Horizontal">
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding HzMin}" />
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="Hz"/>

                            <Button Style="{StaticResource ButtonStyle_empty}" Click="ButtonResetXMinClick" VerticalAlignment="Top">
                                <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="复位" Background="{StaticResource Color_theme_activity}" Foreground="White" Padding="3"/>
                                </Grid>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="X轴最大" />
                        <StackPanel Orientation="Horizontal">
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding HzMax}" />
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="Hz"/>

                            <Button Style="{StaticResource ButtonStyle_empty}" Click="ButtonResetXMaxClick" VerticalAlignment="Top">
                                <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="复位" Background="{StaticResource Color_theme_activity}" Foreground="White" Padding="3"/>
                                </Grid>
                            </Button>
                        </StackPanel>

                    </StackPanel>
                </StackPanel>
                <Button Style="{StaticResource ButtonStyle_empty}" Click="ButtonTestClick" Grid.Column="1">
                    <Grid Style="{StaticResource GridStyle_ButtonShadow}">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="测试" VerticalAlignment="Bottom" Background="{StaticResource Color_theme_noact}" Foreground="White" Padding="10"/>
                    </Grid>
                </Button>
            </Grid>

        </Grid>

        <Grid Background="{StaticResource Brush_theme_bar}" Height="80">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Button Style="{StaticResource ButtonStyle_empty}" Command="BrowseBack" Margin="10">
                <Grid>
                    <Rectangle Width="60" Height="60" Fill="White"/>
                    <Path Fill="{StaticResource Brush_theme_bar}" Data="{StaticResource Geometry_arrow-left-bold}" 
                              SnapsToDevicePixels ="True"
                              Stretch="Fill"
                              Height="30" Width="30" />
                </Grid>
            </Button>
            <TextBlock Grid.Column="1" FontWeight="Bold" FontFamily="Arial" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="35" Text="FFT分析"/>
        </Grid>
    </Grid>
</Page>
