<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="ChartSamples.ChartThemes" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:c1chart="http://schemas.componentone.com/winfx/2006/xaml" xmlns:local="clr-namespace:ChartSamples">
    <UserControl.Resources>
        <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="chartPalettes">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="c1chart:ColorGeneration" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <LinearGradientBrush x:Key="lgb" StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="Transparent" Offset="0" />
            <GradientStop Color="Transparent" Offset="0" />
            <GradientStop Color="Black" Offset="0" />
            <GradientStop Color="Black" Offset="1" />
        </LinearGradientBrush>
        
    <!-- Style for plot elements -->
        <Style x:Key="sstyle" TargetType="{x:Type c1chart:PlotElement}">
            <Setter Property="Canvas.ZIndex" Value="0" />
            <Setter Property="Opacity" Value="1" />
            <Setter Property="StrokeThickness" Value="2" />
            <Setter Property="RenderTransform">
                <Setter.Value>
                        <ScaleTransform ScaleX="1" ScaleY="1" />
                </Setter.Value>
            </Setter>
            <EventSetter Event="c1chart:PlotElement.Loaded" Handler="PlotElement_Loaded" />
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Canvas.ZIndex" Value="1" />
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <local:OscDoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" OscNumber="6" Attenuation="5" To="1.1" Duration="0:0:3" />
                                <local:OscDoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" OscNumber="6" Attenuation="5" To="1.1" Duration="0:0:3" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.3" />
                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.3" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>
            </Style.Triggers>
        </Style>

    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border Grid.Row="0">
            <StackPanel Orientation="Horizontal" Margin="0 0 0 10">
                <Label VerticalAlignment="Center" Content="Theme:" Padding="0,5" />
                <ComboBox Name="themes" SelectedIndex="0" IsEditable="False" Margin="5,0" Height="22" Width="160" ToolTip="Change Theme" SelectionChanged="themes_SelectionChanged">
                    <ComboBoxItem Content="Dusk Blue" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=DuskBlue}}" />
                    <ComboBoxItem Content="Dusk Green" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=DuskGreen}}" />
                    <ComboBoxItem Content="Media Player" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=MediaPlayer}}" />
                    <ComboBoxItem Content="Office 2003 Blue" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2003Blue}}" />
                    <ComboBoxItem Content="Office 2003 Classic" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2003Classic}}" />
                    <ComboBoxItem Content="Office 2003 Olive Green" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2003Olive}}" />
                    <ComboBoxItem Content="Office 2003 Royale" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2003Royale}}" />
                    <ComboBoxItem Content="Office 2003 Silver" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2003Silver}}" />
                    <ComboBoxItem Content="Office 2007 Black" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2007Black}}" />
                    <ComboBoxItem Content="Office 2007 Blue" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2007Blue}}" />
                    <ComboBoxItem Content="Office 2007 Silver" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Office2007Silver}}" />
                    <ComboBoxItem Content="Vista" Tag="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=Vista}}" />

                </ComboBox>

                <Label VerticalAlignment="Center" Content="Chart Type:" Padding="5,5,0,5" />
                <ComboBox Name="chartTypes" SelectedIndex="0" IsEditable="False" Margin="5,0" Width="120" ToolTip="Change Chart Type" Height="22">
                    <ComboBoxItem Content="Column" />
                    <ComboBoxItem Content="Pie" />
                </ComboBox>

                <Label VerticalAlignment="Center" Content="Palette:" Padding="5,5,0,5" />
                <ComboBox Name="palettes" SelectedIndex="0" IsEditable="False" Margin="5,0" Width="120" ToolTip="Change Palette" ItemsSource="{Binding Source={StaticResource chartPalettes}}" SelectionChanged="palettes_SelectionChanged" Tag="{StaticResource lgb}" Height="22">
                </ComboBox>
            </StackPanel>
        </Border>

        <c1chart:C1Chart Grid.Row="1" Name="c1Chart1" ChartType="{Binding ElementName=chartTypes,Path=SelectedItem.Content}" Theme="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1chart:C1Chart, ResourceId=DuskBlue}}">
            <c1chart:C1Chart.OpacityMask>
                <LinearGradientBrush>
                    <GradientStop Color="Transparent" Offset="0" />
                    <GradientStop Color="Transparent" Offset="0" />
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="Black" Offset="1.5" />
                </LinearGradientBrush>
            </c1chart:C1Chart.OpacityMask>
            <c1chart:C1Chart.Data>
                <c1chart:ChartData>
                    <c1chart:ChartData.ItemNames>P1 P2 P3 P4 P5</c1chart:ChartData.ItemNames>
                    <c1chart:DataSeries Label="Series 1" SymbolStyle="{StaticResource sstyle}" Values="20 22 19 24 25" />
                    <c1chart:DataSeries Label="Series 2" SymbolStyle="{StaticResource sstyle}" Values="8 12 10 12 15" />
                    <c1chart:DataSeries Label="Series 3" SymbolStyle="{StaticResource sstyle}" Values="14 10 2 13 25" />
                </c1chart:ChartData>
            </c1chart:C1Chart.Data>
            <c1chart:Legend DockPanel.Dock="Right" />
        </c1chart:C1Chart>
    </Grid>
</UserControl>