<Page x:Class="CurrencyComparison.CurrencyComparisonDemo"
             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:c1="using:C1.Xaml.Chart"
             xmlns:Interaction="using:C1.Xaml.Chart.Interaction"
             xmlns:local="using:CurrencyComparison"
             mc:Ignorable="d">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.Resources>
            <Style TargetType="RadioButton">
                <Setter Property="Margin" Value="5 2 10 2"/>
                <Setter Property="FontSize" Value="10" />
                <Setter Property="MinWidth" Value="20" />
                <Setter Property="MinHeight" Value="10" />
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="GroupName" Value="DateGroup" />
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="60" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical" >
            <StackPanel Orientation="Horizontal">
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=FiveD}" Tag="5D" Checked="HandleRadioButtonChecked" />
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=TenD}" Tag="10D" Checked="HandleRadioButtonChecked"/>
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=OneM}" Tag="1M" Checked="HandleRadioButtonChecked"/>
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=SixM}" IsChecked="True" Tag="6M" Checked="HandleRadioButtonChecked"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=OneY}" Tag="1Y" Checked="HandleRadioButtonChecked"/>
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=FiveY}" Tag="5Y" Checked="HandleRadioButtonChecked"/>
                <RadioButton Content="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=TenY}" Tag="10Y" Checked="HandleRadioButtonChecked"/>
            </StackPanel>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="30 0 0 0">
            <Image Source="ms-appx:///Resources/ImgLegend.png" >
                <Image.RenderTransform>
                    <ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
                </Image.RenderTransform>
            </Image>
            <TextBlock x:Name="tbPeriod" FontSize="10"/>
        </StackPanel>
        <c1:C1FlexChart x:Name="mainChart" FontSize="10" ChartType="Line" LegendToggle="True" LegendPosition="Top" BindingX="Date" Grid.Row="2" PointerMoved="HandleMainChartMouseMove">
            <c1:C1FlexChart.AxisY>
                <c1:Axis AxisLine="True" />
            </c1:C1FlexChart.AxisY>
            <c1:C1FlexChart.Background>
                <ImageBrush ImageSource="ms-appx:///Resources/Img_WaterMark_C1Logo.png" Stretch="None"></ImageBrush>
            </c1:C1FlexChart.Background>
        </c1:C1FlexChart>
        <c1:C1FlexChart x:Name="rangeChart" FontSize="10" ToolTip="{x:Null}" BindingX="Date" LegendPosition="None" ChartType="Line" Grid.Row="3" Rendered="HandleRangeChartRendered">
            <c1:C1FlexChart.AxisX>
                <c1:Axis MajorUnit="366" Position="Bottom" />
            </c1:C1FlexChart.AxisX>
            <c1:C1FlexChart.AxisY>
                <c1:Axis AxisLine="False" Labels="False" MajorGrid="False" MinorTickMarks="None" MajorTickMarks="None" Position="Left" />
            </c1:C1FlexChart.AxisY>
            <c1:C1FlexChart.Layers>
                <Interaction:C1RangeSelector x:Name="rangeSelector" ValueChanged="HandleRangeSelectorValueChanged" />
            </c1:C1FlexChart.Layers>
        </c1:C1FlexChart>
    </Grid>
    <Page.BottomAppBar>
        <AppBar>
            <StackPanel Orientation="Horizontal">
                <StackPanel.Resources>
                    <Style TargetType="ComboBox">
                        <Setter Property="Margin" Value="5 0" />
                        <Setter Property="VerticalContentAlignment" Value="Center" />
                        <Setter Property="FontSize" Value="10" />
                    </Style>
                </StackPanel.Resources>
                <ComboBox Header="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=BaseCurrency}" Width="120" x:Name="cbCurrencies" ItemsSource="{Binding Currencies}" DisplayMemberPath="DisplayName" SelectedValuePath="Symbol" SelectionChanged="HandleCurrenciesSelectionChanged" />
                <ComboBox Header="{Binding Source={StaticResource CurrencyComparisonLocalization}, Path=Measure}" Width="130" x:Name="cbMeasureModes" ItemsSource="{Binding DictMeasureMode}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectionChanged="HandleMeasureModesSelectionChanged"/>
            </StackPanel>
        </AppBar>
    </Page.BottomAppBar>
</Page>
