<Window x:Class="ExtendedFeatures.MainWindow"
        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"
        xmlns:local="clr-namespace:ExtendedFeatures"
        xmlns:samples="clr-namespace:ExtendedFeatures.Samples"
        mc:Ignorable="d" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
        Title="ExtendedFeatures" Height="600" Width="800">
    <Window.DataContext>
        <local:SampleDataSource />
    </Window.DataContext>
    <Grid>
        <Grid.Resources>
            <Style TargetType="Border">
                <Setter Property="BorderBrush" Value="LightGray" />
                <Setter Property="BorderThickness" Value="0 1 0 0" />
            </Style>
            <Style TargetType="TextBlock" x:Key="CaptionStyle">
                <Setter Property="FontSize" Value="15" />
                <Setter Property="Margin" Value="10 5" />
            </Style>
            <Style TargetType="TextBlock" x:Key="GroupCaptionStyle" BasedOn="{StaticResource CaptionStyle}">
                <Setter Property="Foreground" Value="Gray" />
            </Style>
            <Style TargetType="TextBlock" x:Key="SampleCaptionStyle" BasedOn="{StaticResource CaptionStyle}">
                <Setter Property="Foreground" Value="SlateGray" />
                <Setter Property="Cursor" Value="Hand" />
            </Style>
            <Style TargetType="TextBlock" x:Key="TitleStyle">
                <Setter Property="FontFamily" Value="Calibri" />
                <Setter Property="FontSize" Value="30"/>
                <Setter Property="Height" Value="50" />
                <Setter Property="Margin" Value="10 30 20 5" />
            </Style>
            <Style TargetType="TextBlock" x:Key="DescriptionStyle">
                <Setter Property="FontFamily" Value="Calibri"/>
                <Setter Property="FontSize" Value="15" />
                <Setter Property="TextWrapping" Value="Wrap" />
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="Margin" Value="10"/>
            </Style>
            <DataTemplate x:Key="SampleTemplate" >
                <TextBlock Text="{Binding Path=Name}" Style="{StaticResource SampleCaptionStyle}" />
            </DataTemplate>
            <HierarchicalDataTemplate x:Key="GroupTemplate"
                ItemsSource="{Binding Path=Samples}" 
                ItemTemplate="{StaticResource SampleTemplate}">
                <TextBlock Text="{Binding Path=Name}" Style="{StaticResource GroupCaptionStyle}" />
            </HierarchicalDataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border>
            <StackPanel Orientation="Horizontal" Margin="10">
                <Image Source="Resources/C1.png" Width="80" Height="80"/>
                <Grid Margin="20 0">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Text="Extended features" FontWeight="Bold" FontSize="25" VerticalAlignment="Bottom" />
                    <TextBlock Text="A showcase for FlexChart's extended features." Grid.Row="1" />
                </Grid>
            </StackPanel>
        </Border>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TreeView x:Name="lbSamples" Width="200"  BorderBrush="LightGray" ItemsSource="{Binding Groups}" ItemTemplate="{StaticResource GroupTemplate}" SelectedItemChanged="OnSelectedItemChanged">
                <TreeView.ItemContainerStyle>
                    <Style TargetType="TreeViewItem">
                        <Setter Property="IsExpanded" Value="True" />
                        <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                    </Style>
                </TreeView.ItemContainerStyle>
                <TreeView.Resources>
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                      Color="#20101010" />
                </TreeView.Resources>
            </TreeView>
            <Grid DataContext="{Binding ElementName=lbSamples, Path=SelectedValue}" Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Border>
                    <TextBlock Text="{Binding Name}" Style="{StaticResource TitleStyle}" />
                </Border>
                <Border Grid.Row="1">
                    <TextBlock Text="{Binding Description}" Style="{StaticResource DescriptionStyle}"/>
                </Border>
                <Border Grid.Row="2">
                    <ContentControl Content="{Binding View}" />
                </Border>
            </Grid>
        </Grid>
    </Grid>
</Window>
