<Page x:Class="DataManipulation.AggregateView"
      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:DataManipulation"
      xmlns:c1="using:C1.Xaml.Chart"
      xmlns:Annotation="using:C1.Xaml.Chart.Annotation"
      mc:Ignorable="d" 
      d:DesignHeight="600" d:DesignWidth="600">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.DataContext>
            <local:AggregateViewModel />
        </Grid.DataContext>
        <Grid.Resources>
            <local:Boolean2StackingConverter x:Key="Boolean2StackingConverter" />
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel MinHeight="48" Grid.Row="0" Orientation="Horizontal">
            <ComboBox x:Name="cbProperty" Margin="5" MinWidth="120" ItemsSource="{Binding AggregateProperties}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectedValue="{Binding AggregateProperty, Mode=TwoWay}"/>
            <ComboBox x:Name="cbTopNCount" Margin="5" MinWidth="120" ItemsSource="{Binding AggregateTypes}"  DisplayMemberPath="Key" SelectedValuePath="Value"  SelectedValue="{Binding AggregateType, Mode=TwoWay}" />
        </StackPanel>

        <c1:C1FlexChart x:Name="flexChart1" Grid.Row="1"
                        Header="Sales data" BindingX="Key" LegendToggle="True"
                        ItemsSource="{Binding DataSource}">
            <c1:Series SeriesName="Value" Binding="Value"/>
        </c1:C1FlexChart>
    </Grid>
</Page>
