<UserControl x:Class="ControlExplorer.Controls.Chart.LegendCheckBox"
    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="480" d:DesignWidth="480"
    xmlns:c1="using:C1.Xaml.Chart"
    xmlns:local="using:ControlExplorer.Controls.Chart">
    <UserControl.Resources>
        <local:VisibilityConverter x:Key="vconv" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" >
        <c1:C1Chart Name="chart" ChartType="LineSymbols" >
            <!--<c1:C1Chart.Data>
                <c1:ChartData>
                    <c1:DataSeries Values="1,2,3,4" Label="series 1" />
                    <c1:DataSeries Values="1,4,2,2" Label="series 2" />
                    <c1:DataSeries Values="4,2,1,4" Label="series 3" />
                </c1:ChartData>
            </c1:C1Chart.Data>-->
            <c1:C1ChartLegend FontSize="14" Position="Bottom" Orientation="Horizontal">
                <c1:C1ChartLegend.ItemTemplate>
                    <DataTemplate >
                        <StackPanel Orientation="Horizontal" Margin="0,-2,0,-2">
                            <CheckBox Margin="0,2" VerticalAlignment="Center" 
                        IsChecked="{Binding Item.Visibility,Mode=TwoWay,Converter={StaticResource vconv}}" />

                            <Canvas Margin="-20,0,0,0" Width="24" Height="24" Background="Transparent">
                                <ContentPresenter Canvas.Top="2" 
                              Content="{Binding Path=Line}" 
                              Width="24" Height="20"/>
                                <ContentPresenter 
                  Canvas.Left="5" Canvas.Top="5" 
                  Content="{Binding Path=Symbol}" 
                  Width="14" Height="14"/>
                            </Canvas>
                            <TextBlock Margin="2"
                       Text="{Binding Path=Label}" 
                       VerticalAlignment="Center"/>
                        </StackPanel>
                    </DataTemplate>

                </c1:C1ChartLegend.ItemTemplate>
            </c1:C1ChartLegend>
        </c1:C1Chart>

    </Grid>
</UserControl>
