<UserControl x:Class="SunburstIntro.SunburstSelection"
             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>
            <local:EnumToStringConverter x:Key="SelectedItemPositionConverter" />
        </Grid.Resources>
        <Grid.DataContext>
            <local:SunburstViewModel />
        </Grid.DataContext>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <StackPanel.Resources>
                <Style TargetType="ComboBox">
                    <Setter Property="VerticalContentAlignment" Value="Center" />
                    <Setter Property="Width" Value="200" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="ItemTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <TextBlock>
                                    <TextBlock.Inlines>
                                        <Run Text="Selected item Position: "/>
                                        <Run Text="{Binding Path=.}" />
                                    </TextBlock.Inlines>
                                </TextBlock>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </StackPanel.Resources>
            <TextBlock Text="Selected Item Offset" VerticalAlignment="Center"/>
            <c1:C1NumericBox Width="120" Height="25" Margin="5 0 50 0" Minimum="0" Maximum="0.5" Increment="0.1" Format="f1" Value="{Binding ElementName=sunburst, Path=SelectedItemOffset, Mode=TwoWay}"/>
            <ComboBox ItemsSource="{Binding Positions}" SelectedValue="{Binding ElementName=sunburst, Path=SelectedItemPosition, Converter={StaticResource SelectedItemPositionConverter}}"/>
        </StackPanel>
        <c1:C1Sunburst x:Name="sunburst" ItemsSource="{Binding FlatData}" Binding="Value" BindingName="Year,Quarter,Month" ToolTipContent="{}{name}&#x000A;{y}" SelectionMode="Point" SelectedItemPosition="Top" Grid.Row="1">
            <c1:C1Sunburst.SelectionStyle>
                <c1:ChartStyle Stroke="Red" StrokeDashArray="4 2" />
            </c1:C1Sunburst.SelectionStyle>
            <c1:C1Sunburst.DataLabel>
                <c1:PieDataLabel Position="Center" Content="{}{name}" />
            </c1:C1Sunburst.DataLabel>
        </c1:C1Sunburst>
    </Grid>
</UserControl>
