<UserControl x:Class="WorkingWithEventsInMultiChart.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:DesignHeight="300" d:DesignWidth="400"
    xmlns:local="clr-namespace:WorkingWithEventsInMultiChart"
    xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts">

    <UserControl.DataContext >
        <local:MainPageViewModel />
    </UserControl.DataContext>

    <UserControl.Resources >
        <local:SeriesTemplateSelector x:Key="chartTemplateSelector">

            <local:SeriesTemplateSelector.SalesTemplate>
                <DataTemplate >
                    <vc:DataSeries RenderAs="Spline" LegendText="{Binding SalesName}" DataSource="{Binding SalesTotals}" >
                        <vc:DataSeries.DataMappings>
                            <vc:DataMapping MemberName="AxisXLabel" Path="Date"  ></vc:DataMapping>
                            <vc:DataMapping MemberName="YValue" Path="SalesTotal"  ></vc:DataMapping>
                        </vc:DataSeries.DataMappings>
                    </vc:DataSeries>
                </DataTemplate>
            </local:SeriesTemplateSelector.SalesTemplate>

            <local:SeriesTemplateSelector.MedianTemplate>
                <DataTemplate>
                    <vc:DataSeries RenderAs="Column" LegendText="{Binding SalesName}" DataSource="{Binding SalesTotals}">
                        <vc:DataSeries.DataMappings>
                            <vc:DataMapping MemberName="AxisXLabel" Path="Date"  ></vc:DataMapping>
                            <vc:DataMapping MemberName="YValue" Path="SalesTotal"  ></vc:DataMapping>
                        </vc:DataSeries.DataMappings>
                    </vc:DataSeries>
                </DataTemplate>
            </local:SeriesTemplateSelector.MedianTemplate>

        </local:SeriesTemplateSelector>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" HorizontalAlignment="Center" VerticalAlignment="Center">

        <StackPanel Orientation="Vertical" >

            <!-- ======================================= 1st Chart ================================== -->

            <local:MultiChart x:Name="MutiChart1" SeriesSource="{Binding SalesData}" Height="300" Width="400" View3D="True" ScrollingEnabled="False" >

                <local:MultiChart.Titles>
                    <vc:Title Text="Click on a DataPoint"></vc:Title>
                </local:MultiChart.Titles>

                <local:MultiChart.SeriesTemplate >
                    <DataTemplate >

                        <vc:DataSeries RenderAs="Column" LegendText="{Binding SalesName}" DataSource="{Binding SalesTotals}" Cursor="Hand">
                            <vc:DataSeries.DataMappings>
                                <vc:DataMapping MemberName="AxisXLabel" Path="Date"  ></vc:DataMapping>
                                <vc:DataMapping MemberName="YValue" Path="SalesTotal"  ></vc:DataMapping>
                            </vc:DataSeries.DataMappings>
                        </vc:DataSeries>

                    </DataTemplate>
                </local:MultiChart.SeriesTemplate>

            </local:MultiChart>

        </StackPanel>
    </Grid>
</UserControl>
