<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 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>
            <Controls:RangeSlider Grid.Row="1" 
                                    Margin="5"
                                    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 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>
