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

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Chart:C1FlexChart x:Name="flexChart" ItemsSource="{Binding DataContext.Data}" LegendPosition="Bottom" FontSize="10">
            <Chart:C1FlexChart.Series>
                <Chart:Series Binding="Volume" BindingX="Time" ChartType="Column" SeriesName="Volume">
                    <Chart:Series.AxisY>
                        <Chart:Axis Position="Right" MajorGrid="False"></Chart:Axis>
                    </Chart:Series.AxisY>
                </Chart:Series>
                <Chart:Series Binding="High,Low,Open,Close" x:Name="financialSeries" SymbolSize="5" ChartType="Candlestick" BindingX="Time" SeriesName="price" />
            </Chart:C1FlexChart.Series>
            <Chart:C1FlexChart.AxisY>
                <Chart:Axis Min="500" Position="Left" AxisLine="False" MajorGrid="True" MajorTickMarks="None"></Chart:Axis>
            </Chart:C1FlexChart.AxisY>
        </Chart:C1FlexChart>
    </Grid>
    <Page.BottomAppBar>
        <AppBar>
            <AppBar.Resources>
                <local:ChartTypeConverter ChartTypes="{Binding DataContext.ChartTypes}" x:Key="chartTypeConverter" />
                <Style TargetType="ComboBox">
                    <Style.Setters>
                        <Setter Property="Width" Value="300" />
                        <Setter Property="FontSize" Value="12" />
                        <Setter Property="ItemTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <TextBlock>
                                        <TextBlock.Inlines>
                                            <Run Text="{Binding Charttype_Text, Source={StaticResource FlexChartExplorerLocalization}}"></Run>
                                            <Run Text="{Binding Value}"></Run>
                                        </TextBlock.Inlines>
                                    </TextBlock>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style.Setters>
                </Style>
            </AppBar.Resources>
            <ComboBox x:Name="cbChartType" ItemsSource="{Binding DataContext.ChartTypes}" VerticalAlignment="Center" Width="210"
                      SelectedIndex="{Binding DataContext.FinancialSeriesInstance.ChartType, Mode=TwoWay, Converter={StaticResource chartTypeConverter}}">
            </ComboBox>
        </AppBar>
    </Page.BottomAppBar>
</Page>
