<Page 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:Chart="using:C1.Xaml.Chart"
      xmlns:local="using:SunburstIntro"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="10">
        <Grid.Resources>
            <Chart: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" Margin="10">
            <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="210" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="ItemTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <TextBlock>
                                    <TextBlock.Inlines>
                                        <Run Text="{Binding Source={StaticResource SunburstIntroLocalization}, Path=LegendPosition}"/>
                                        <Run Text="{Binding}" />
                                    </TextBlock.Inlines>
                                </TextBlock>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </StackPanel.Resources>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Source={StaticResource SunburstIntroLocalization}, Path=Header}" />
                <TextBox Text="{Binding ElementName=sunburst, Path=Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                <TextBlock Text="{Binding Source={StaticResource SunburstIntroLocalization}, Path=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}, Mode=TwoWay}"/>
            </StackPanel>
        </StackPanel>
        <Chart:C1Sunburst x:Name="sunburst" ItemsSource="{Binding HierarchicalData}" ChildItemsPath="Items" ToolTipContent="{}{name}&#x000A;{y}" Binding="Value" 
                        BindingName="Year,Quarter,Month"
                        Header="{Binding Source={StaticResource SunburstIntroLocalization}, Path=HeaderContent}"
                        Footer="{Binding Source={StaticResource SunburstIntroLocalization}, Path=FooterContent}"
                        HeaderStyle="{StaticResource footerAndHeaderStyle}"
                        FooterStyle="{StaticResource footerAndHeaderStyle}"
                        Grid.Row="1">
        </Chart:C1Sunburst>
    </Grid>
</Page>
