<Page x:Class="FinancialChartExplorer.RangeSelector"
      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="using:FinancialChartExplorer"
      xmlns:Chart="using:C1.Xaml.Chart.Finance"
      xmlns:Interaction="using:C1.Xaml.Chart.Interaction"
      xmlns:FlexChart="using:C1.Xaml.Chart"
      mc:Ignorable="d" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
      d:DesignHeight="300" d:DesignWidth="300">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition x:Name="row" Height="100" />
        </Grid.RowDefinitions>
        <Chart:C1FinancialChart x:Name="candlestickChart" ToolTipContent="{}Date: {Date}&#x000A;Open: {Open}&#x000A;High: {High}&#x000A;Low: {Low}&#x000A;Close: {Close}" BindingX="Date" Binding="High,Low,Open,Close,Volume" ChartType="Candlestick" ItemsSource="{Binding Data}">
            <Chart:FinancialSeries />
        </Chart:C1FinancialChart>
        <Chart:C1FinancialChart x:Name="financialChart" BindingX="Date" Binding="Close" ChartType="Line" ToolTip="{x:Null}" Grid.Row="1" ItemsSource="{Binding Data}">
            <Chart:FinancialSeries />
            <Chart:C1FinancialChart.Layers>
                <Interaction:C1RangeSelector x:Name="rangeSelector" ValueChanged="OnRangeSelectorValueChanged" />
            </Chart:C1FinancialChart.Layers>
        </Chart:C1FinancialChart>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="candlestickChart.FontSize" Value="12"/>
                        <Setter Target="financialChart.FontSize" Value="12" />
                        <Setter Target="row.Height" Value="70" />
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="420" />
                    </VisualState.StateTriggers>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>
