<Page
    x:Class="FinancialChartExplorer.Overlays"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FinancialChartExplorer"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Finance="using:C1.Xaml.Chart.Finance"
    xmlns:Chart="using:C1.Xaml.Chart"
    xmlns:Xaml="using:C1.Xaml"
    DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Finance:C1FinancialChart
            x:Name="overlayChart"
            ItemsSource="{Binding Data}"
            PointerMoved="overlayChart_PointerMoved"
            PointerPressed="overlayChart_PointerPressed"
            Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
            ChartType="Candlestick"
            BindingX="Date">
            <Finance:FinancialSeries Binding="High,Low,Open,Close" SeriesName="Box"/>
            <Finance:BollingerBands x:Name="bollinger" Period="20" Binding="High,Low,Close" SeriesName="Bolligner Bands"/>
            <Finance:Envelopes x:Name="envelopes" Period="20" Size="0.03" Binding="High,Low,Close" SeriesName="Envelopes"/>
            <Finance:C1FinancialChart.AxisX>
                <Chart:Axis LabelAngle="45" MajorUnit="3"/>
            </Finance:C1FinancialChart.AxisX>
        </Finance:C1FinancialChart>
        <StackPanel Grid.Row="1" Margin="0 10">
            <StackPanel.Resources>
                <Style TargetType="Xaml:C1NumericBox">
                    <Setter Property="Width" Value="200"/>
                    <Setter Property="Margin" Value="10 0 20 0"/>
                </Style>
                <Style TargetType="TextBlock">
                    <Setter Property="VerticalAlignment" Value="Center"/>
                </Style>
            </StackPanel.Resources>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Source={StaticResource FinancialChartExplorerLocalization}, Path=OverlayCaption}" Margin="10 0"/>
                <ComboBox x:Name="cbOverlays" ItemsSource="{Binding OverlayTypes}" Width="150" SelectionChanged="cbOverlays_SelectionChanged"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" x:Name="spBollingerOptions" Margin="0 10">
                <TextBlock Text="{Binding Source={StaticResource FinancialChartExplorerLocalization}, Path=PeriodCaption}" Margin="15 0 0 0"/>
                <Xaml:C1NumericBox x:Name="cbPeriod" Value="20" Minimum="2" Maximum="86" ValueChanged="cbPeriod_ValueChanged"/>
                <TextBlock Text="{Binding Source={StaticResource FinancialChartExplorerLocalization}, Path=MultiplierCaptin}"/>
                <Xaml:C1NumericBox x:Name="cbMultiplier" Value="2" Minimum="1" Maximum="100" ValueChanged="cbMultiplier_ValueChanged"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" x:Name="spEnvelopesOptions" Visibility="Collapsed" Margin="0 10">
                <TextBlock Text="{Binding Source={StaticResource FinancialChartExplorerLocalization}, Path=PeriodCaption}" Margin="15 0 0 0"/>
                <Xaml:C1NumericBox x:Name="cbEnvelopesPeriod" Value="20" Minimum="2" Maximum="86" ValueChanged="cbEnvelopesPeriod_ValueChanged"/>
                <TextBlock Text="{Binding Source={StaticResource FinancialChartExplorerLocalization}, Path=SizeCaption}"/>
                <Xaml:C1NumericBox x:Name="cbSize" Value="0.03" Minimum="0" Maximum="1" Format="P" ValueChanged="cbSize_ValueChanged"/>
                <TextBlock Text="{Binding Source={StaticResource FinancialChartExplorerLocalization}, Path=TypeCaption}" Margin="0 0 10 0"/>
                <ComboBox x:Name="cbTypes" ItemsSource="{Binding Types}" Width="120" SelectionChanged="cbTypes_SelectionChanged"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</Page>
