<UserControl x:Class="MultiChartDemo.MainPage"
    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" 
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    xmlns:local="clr-namespace:MultiChartDemo" 
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"                   
             >
    <UserControl.DataContext >
        <local:MainPageViewModel />
    </UserControl.DataContext>
    <UserControl.Resources >
        <local:SeriesTemplateSelector x:Key="chartTemplateSelector">
            <local:SeriesTemplateSelector.SalesTemplate>
                <DataTemplate >
                    <chartingToolkit:LineSeries
                                    Title="{Binding SalesName}"
                                    ItemsSource="{Binding SalesTotals}"
                                    IndependentValueBinding="{Binding Date}"
                                    DependentValueBinding="{Binding SalesTotal}" />
                </DataTemplate>
            </local:SeriesTemplateSelector.SalesTemplate>
            <local:SeriesTemplateSelector.MedianTemplate>
                <DataTemplate >
                    <chartingToolkit:ColumnSeries
                                    Title="{Binding SalesName}"
                                    ItemsSource="{Binding SalesTotals}"
                                    IndependentValueBinding="{Binding Date}"
                                    DependentValueBinding="{Binding SalesTotal}" />
                </DataTemplate>
            </local:SeriesTemplateSelector.MedianTemplate>
        </local:SeriesTemplateSelector>

    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">



        <local:UniformGrid >
            <chartingToolkit:Chart Title="Typical Use" >
                <chartingToolkit:ColumnSeries
    					Title="{Binding SalesDetail.SalesName}"
    					ItemsSource="{Binding SalesDetail.SalesTotals}"
    					IndependentValueBinding="{Binding Date}"
    					DependentValueBinding="{Binding SalesTotal}" />
            </chartingToolkit:Chart>

            <chartingToolkit:Chart Title="Typical Use" >
                <chartingToolkit:LineSeries
    					Title="{Binding SalesDetail.SalesName}"
    					ItemsSource="{Binding SalesDetail.SalesTotals}"
    					IndependentValueBinding="{Binding Date}"
    					DependentValueBinding="{Binding SalesTotal}" />
            </chartingToolkit:Chart>


            <local:MultiChart SeriesSource="{Binding SalesData}"
                              Title="Dynamic Multi Lines">
                <local:MultiChart.SeriesTemplate >
                    <DataTemplate >
                        <chartingToolkit:LineSeries
                                Title="{Binding SalesName}"
                                ItemsSource="{Binding SalesTotals}"
                                IndependentValueBinding="{Binding Date}"
                                DependentValueBinding="{Binding SalesTotal}" />
                    </DataTemplate>
                </local:MultiChart.SeriesTemplate>

            </local:MultiChart>

            <local:MultiChart SeriesSource="{Binding SalesDataWithMedian}"
                              SeriesTemplateSelector="{StaticResource chartTemplateSelector}"
                              Title="Dynamic Multi Lines with different DataTemplates">

            </local:MultiChart>


        </local:UniformGrid>



    </Grid>
</UserControl>
