<Page x:Class="ControlExplorer.SamplePage" 
           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:c1="http://schemas.componentone.com/winfx/2006/xaml"
           xmlns:local="clr-namespace:ControlExplorer"
           mc:Ignorable="d"
           d:DataContext="{d:DesignData Source=/DesignData/FeatureData.xaml}">
    <Page.Resources>
        <Storyboard x:Key="LoadStoryboard">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="textBlock">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="textBlock1">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="tabControl">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="tree">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="textBlock1">
                <EasingDoubleKeyFrame KeyTime="0" Value="880"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="880.509"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="rectangle1">
                <EasingDoubleKeyFrame KeyTime="0" Value="310"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="311.154"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="rectangle2">
                <EasingDoubleKeyFrame KeyTime="0" Value="310"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="311.154"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle1">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle2">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

        </Storyboard>
        <Storyboard x:Key="ChangeSampleStoryboard">
            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="textBlock" d:IsOptimized="True"/>
            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="textBlock1">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="tabControl">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="tree" d:IsOptimized="True"/>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="textBlock1">
                <EasingDoubleKeyFrame KeyTime="0" Value="880"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="880.509"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="rectangle2">
                <EasingDoubleKeyFrame KeyTime="0" Value="310"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="311.154"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="rectangle2">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Style TargetType="c1:PropertyBox" x:Key="PropertiesPropertyBox">
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Padding" Value="3 5"/>
            <Setter Property="MinHeight" Value="22"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="c1:PropertyBox">
                        <Grid x:Name="Root" Margin="{TemplateBinding Padding}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="ExpansionStates">
                                    <VisualState x:Name="ResetButtonHidden"/>
                                    <VisualState x:Name="ResetButtonShown"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock x:Name="Label" 
                                VerticalAlignment="Center" Margin="0 0 2 0"/>
                            <Border x:Name="EditorBorder" 
                                VerticalAlignment="Center" 
                                Grid.Column="1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
    <Grid x:Name="LayoutRoot">
        <local:PageFrame>
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="110"/>
                    <RowDefinition />
                    <RowDefinition Height="20" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45" />
                    <ColumnDefinition Width="180" />
                    <ColumnDefinition Width="10" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="45" />
                </Grid.ColumnDefinitions>
                <Rectangle x:Name="rectangle1" Opacity="0" Fill="#FFEEEEEE" Grid.Column="1" Grid.Row="1" Stroke="#FFBBBBBB" Margin="0,1,-0.333,-1" RenderTransformOrigin="0.5,0.5">
                    <Rectangle.RenderTransform>
                        <TranslateTransform/>
                    </Rectangle.RenderTransform>
                </Rectangle>
                <Rectangle x:Name="rectangle2" Opacity="0" Fill="White" Grid.Column="3" Grid.Row="1" Stroke="#FFBBBBBB" Margin="-0.333,1,0,-1" RenderTransformOrigin="0.5,0.5">
                    <Rectangle.RenderTransform>
                        <TranslateTransform/>
                    </Rectangle.RenderTransform>
                </Rectangle>

                <!--Control Title & Description-->
                <Grid VerticalAlignment="Center" Grid.Column="1" Grid.ColumnSpan="3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBlock x:Name="textBlock" Opacity="0" Text="{Binding Control.Name}" Style="{StaticResource SamplePageTitle}" Margin="0 0 0 5"/>
                    <Rectangle x:Name="rectangle" Opacity="0" VerticalAlignment="Center" Width="2" Margin="8" Grid.Column="1" Fill="#FF0C5C81" Height="42" />
                    <TextBlock x:Name="textBlock1" Opacity="0" Text="{Binding Description}" Grid.Column="2" Style="{StaticResource SamplePageDescription}" RenderTransformOrigin="0.5,0.5">
                        <TextBlock.RenderTransform>
                            <TranslateTransform/>
                        </TextBlock.RenderTransform>
                    </TextBlock>
                </Grid>
                <!--Body-->
                <c1:C1TabControl x:Name="tabControl" Grid.Row="1" Grid.Column="3" Padding="0" Opacity="0" TabStripHorizontalAlignment="Right" TabItemShape="Rectangle" BorderBrush="#FFBBBBBB" PressedBrush="{x:Null}" MouseOverBrush="#FFC2C2C2" TabStripBackground="#FFABABAB" TabStripOverlap="3" Margin="0,-30,0,0" >
                    <c1:C1TabItem Header="sample" Style="{StaticResource SampleTabItem}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ContentPresenter Content="{Binding Sample}" Margin="8" />
                            <c1:C1Expander Grid.Column="1" IsExpanded="True" Visibility="{Binding PropertiesVisibility}" Style="{StaticResource PropertiesExpander}">
                                <c1:C1PropertyGrid x:Name="properties" Width="280" AddingPropertyBox="properties_AddingPropertyBox" SelectedObject="{Binding Sample}" AutoGenerateProperties="False" Style="{StaticResource PropertiesPropertyGrid}" />
                            </c1:C1Expander>
                        </Grid>
                    </c1:C1TabItem>
                    <c1:C1TabItem Header="code" Style="{StaticResource SampleTabItem}" >
                        <local:SourceCode x:Name="code"/>
                    </c1:C1TabItem>
                </c1:C1TabControl>

                <!-- Samples List -->
                <c1:C1TreeView x:Name="tree" Grid.Row="1" Grid.Column="1" Opacity="0"
                               ItemsSource="{Binding Control.Features}" 
                               ItemPrepared="tree_ItemPrepared" 
                               ItemClick="tree_ItemClick" 
                               SelectionMode="Single"
                               SnapsToDevicePixels="True" 
                               Grid.ColumnSpan="2" 
                               HorizontalContentAlignment="Stretch" 
                               Style="{StaticResource SamplePageTreeView}" 
                               Margin="0,0,-5,0">
                    <c1:C1TreeView.ItemTemplate>
                        <c1:C1HierarchicalDataTemplate ItemsSource="{Binding SubFeatures}">
                            <Grid Height="30">
                                <TextBlock VerticalAlignment="Center" FontSize="13" Text="{Binding Name}"/>
                            </Grid>
                        </c1:C1HierarchicalDataTemplate>
                    </c1:C1TreeView.ItemTemplate>
                </c1:C1TreeView>
            </Grid>
        </local:PageFrame>

    </Grid>
</Page>
