<UserControl x:Class="SunburstIntro.LegendTitles"
             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:c1="http://schemas.componentone.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:SunburstIntro"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.Resources>
            <c1:ChartStyle x:Key="footerAndHeaderStyle" Fill="DimGray" FontFamily="GenericSansSerif" FontSize="20" />
            <local:EnumToStringConverter x:Key="PositionConverter" />
        </Grid.Resources>
        <Grid.DataContext>
            <local:SunburstViewModel />
        </Grid.DataContext>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical">
            <StackPanel.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="HorizontalAlignment" Value="Right"/>
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="Margin" Value="0 0 5 0" />
                </Style>
                <Style TargetType="TextBox">
                    <Setter Property="Width" Value="300" />
                    <Setter Property="Height" Value="30" />
                    <Setter Property="Margin" Value="0 0 60 0" />
                    <Setter Property="VerticalContentAlignment" Value="Center" />
                </Style>
                <Style TargetType="ComboBox">
                    <Setter Property="VerticalContentAlignment" Value="Center" />
                    <Setter Property="Width" Value="160" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="ItemTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <TextBlock>
                                    <TextBlock.Inlines>
                                        <Run Text="Legend Position: "/>
                                        <Run Text="{Binding Path=.}" />
                                    </TextBlock.Inlines>
                                </TextBlock>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </StackPanel.Resources>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Header" />
                <TextBox Text="{Binding ElementName=sunburst, Path=Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                <TextBlock Text="Footer" />
                <TextBox Text="{Binding ElementName=sunburst, Path=Footer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                <ComboBox ItemsSource="{Binding Positions}" SelectedValue="{Binding ElementName=sunburst, Path=LegendPosition, Converter={StaticResource PositionConverter}}"/>
            </StackPanel>
        </StackPanel>
        <c1:C1Sunburst x:Name="sunburst" ItemsSource="{Binding HierarchicalData}" ChildItemsPath="Items" ToolTipContent="{}{name}&#x000A;{y}" Binding="Value" 
                     BindingName="Year,Quarter,Month"
                     Header="Sales" Footer="copyright © GrapeCity, inc."
                     HeaderStyle="{StaticResource footerAndHeaderStyle}"
                     FooterStyle="{StaticResource footerAndHeaderStyle}"
                     Grid.Row="1">
        </c1:C1Sunburst>
    </Grid>
</UserControl>
