<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" xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
      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"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>

            <lvc:CartesianChart Hoverable="False" DisableAnimations="True" DataTooltip="{x:Null}" Margin="10" MouseDown="UIElement_OnMouseDown">
                <lvc:CartesianChart.Series>
                    <lvc:LineSeries 
                        Values="{Binding Values}"
                        StrokeThickness = "3"
                        Stroke = "{StaticResource Brushes.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="Orange"
                                         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>
            <Controls:RangeSlider Grid.Row="1" 
                                    Margin="{StaticResource ControlMargin}"
                                    Controls:SliderHelper.ChangeValueBy="LargeChange"
                                    Controls:SliderHelper.EnableMouseWheel="MouseHover"
                                    AutoToolTipPlacement="TopLeft"
                                    LargeChange="10"
                                    Maximum="{Binding XRangeSliderMax}"
                                    Minimum="{Binding XRangeSliderMin}"
                                    Orientation="Horizontal"
                                    SmallChange="1"
                                    LowerValue="{Binding LowerValue}"
                                    UpperValue="{Binding UpperValue}" />
            <Grid Grid.Row="2" Margin="{StaticResource ControlMargin}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>

                <Button Style="{StaticResource Styles.Button.Square2}" Grid.Column="1" Click="ButtonTestClick" Content="测试"/>


            </Grid>

        </Grid>
        <Grid Background="{StaticResource Brushes.TitleBar.Background}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" >
                <Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack"/>
                <TextBlock Style="{StaticResource Styles.TitleBar.Text}" Text="FFT分析"/>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
