<UserControl x:Class="FlexChartExplorer.BoxWhisker"
             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="clr-namespace:FlexChartExplorer"
             xmlns:Chart="http://schemas.componentone.com/winfx/2006/xaml"
             DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.Resources>
            <local:EnumConverter x:Key="enumConverter" />
            <Style TargetType="ComboBox">
                <Setter Property="Width" Value="220"></Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <TextBlock>
                                <TextBlock.Inlines>
                                    <Run Text="Quartile Calculation: "/>
                                    <Run Text="{Binding .}"/>
                                </TextBlock.Inlines>
                            </TextBlock>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Margin="10">
            <ComboBox ItemsSource="{Binding DataContext.Calculations}"
                      x:Name="cboQuartileCalculation" SelectedIndex="0"
                      SelectionChanged="cboQuartileCalculation_SelectionChanged"></ComboBox>
            <CheckBox VerticalAlignment="Center" Margin="5,0,0,0" x:Name="cbShowMeanLine" Checked="CheckedChanged" Unchecked="CheckedChanged">Show mean line</CheckBox>
            <CheckBox VerticalAlignment="Center" Margin="5,0,0,0" x:Name="cbShowMeanMarks" IsChecked="True" Checked="CheckedChanged" Unchecked="CheckedChanged">Show mean marks</CheckBox>
            <CheckBox VerticalAlignment="Center" Margin="5,0,0,0" x:Name="cbShowOutliers" IsChecked="True" Checked="CheckedChanged" Unchecked="CheckedChanged">Show outliers</CheckBox>
            <CheckBox VerticalAlignment="Center" Margin="5,0,0,0" x:Name="cbShowInnerPoints" Checked="CheckedChanged" Unchecked="CheckedChanged">Show inner points</CheckBox>
            <CheckBox VerticalAlignment="Center" Margin="5,0,0,0" IsChecked="{Binding ElementName=flexChart,Path=Rotated}">Rotate</CheckBox>
        </StackPanel>
        <Chart:C1FlexChart BindingX="ClassName" ItemsSource="{Binding DataContext.Data}" Grid.Row="1" x:Name="flexChart" ToolTipContent="{}{seriesName} - {name}&#x000A;Min: {Min}&#x000A;First Quartile: {FirstQuartile}&#x000A;Mean: {Mean}&#x000A;Median: {Median}&#x000A;Third Quartile: {ThirdQuartile}&#x000A;Max: {Max}">
            <Chart:BoxWhisker Binding="SchoolA" 
                              SeriesName="SchoolA" 
                              x:Name="boxWhiskerA"/>
            <Chart:BoxWhisker Binding="SchoolB" 
                              SeriesName="SchoolB" 
                              x:Name="boxWhiskerB"/>
            <Chart:BoxWhisker Binding="SchoolC" 
                              SeriesName="SchoolC" 
                              x:Name="boxWhiskerC"/>
        </Chart:C1FlexChart>
    </Grid>
</UserControl>
