<Page
    x:Name="pageRoot"
    x:Class="ControlExplorer.HomePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ControlExplorer"
    xmlns:common="using:ControlExplorer.Common"
    DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Xaml ="using:C1.Xaml"
    mc:Ignorable="d">

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{ThemeResource ControlExplorerBackgroundThemeBrush}">
        <Grid.Resources>
            <Style TargetType="HyperlinkButton" x:Key="HyperlinkButtonStyle">
                <Setter Property="Foreground" Value="{ThemeResource ControlExplorerHubSectionHeaderThemeBrush}" />
                <Setter Property="BorderThickness" Value="{ThemeResource HyperlinkButtonBorderThemeThickness}" />
                <Setter Property="Padding" Value="0,6,0,6" />
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
                <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
                <Setter Property="UseSystemFocusVisuals" Value="True" />
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="Width" Value="88" />
                <Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" />
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="HyperlinkButton">
                            <Grid x:Name="RootGrid">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="PointerOver">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                     Storyboard.TargetProperty="Background">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="#a2a2a2" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Pressed">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                     Storyboard.TargetProperty="Background">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="#262c56" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                     Storyboard.TargetProperty="Foreground">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <ContentPresenter x:Name="ContentPresenter"
                                                  Background="{TemplateBinding Background}"
                                                  BorderBrush="{TemplateBinding BorderBrush}"
                                                  BorderThickness="{TemplateBinding BorderThickness}"
                                                  Content="{TemplateBinding Content}"
                                                  ContentTransitions="{TemplateBinding ContentTransitions}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Padding="{TemplateBinding Padding}"
                                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  AutomationProperties.AccessibilityView="Raw"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="10">
            <Image x:Name="logo" Source="/Assets/logo_Studio_UWP_0215.png" Height="54" />
        </StackPanel>
        <Border Background="{ThemeResource ControlExplorerLightStripeThemeBrush}" Height="50" VerticalAlignment="Top" Margin="0 70 0 0" >
            <Grid Margin="10 0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="150"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="200" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding Source={StaticResource ControlExplorerLocalization}, Path=App_Title}" VerticalAlignment="Center" Foreground="{StaticResource ControlExplorerHubSectionHeaderThemeBrush}" />
                <HyperlinkButton Content="{Binding Source={StaticResource ControlExplorerLocalization}, Path=About_Text}" 
                                 Style="{StaticResource HyperlinkButtonStyle}" 
                                 Command="{Binding NavigationHelper.NavigateCommand}" 
                                 CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Tag}" 
                                 Tag="https://www.grapecity.com/en/uwp" 
                                 Grid.Column="1" />
                <HyperlinkButton Content="{Binding Source={StaticResource ControlExplorerLocalization}, Path=Support_Text}" 
                                 Style="{StaticResource HyperlinkButtonStyle}" 
                                 Command="{Binding NavigationHelper.NavigateCommand}"
                                 CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Tag}" 
                                 Tag="https://www.grapecity.com/en/support/contact" 
                                 Grid.Column="2" />
                <HyperlinkButton Content="{Binding Source={StaticResource ControlExplorerLocalization}, Path=Pricing_Text}"
                                 Style="{StaticResource HyperlinkButtonStyle}" Command="{Binding NavigationHelper.NavigateCommand}"
                                 CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Tag}" 
                                 Tag="https://www.grapecity.com/en/pricing"
                                 Grid.Column="3" />
                <HyperlinkButton Content="{Binding Source={StaticResource ControlExplorerLocalization}, Path=FreeTrial_Text}" 
                                 Style="{StaticResource HyperlinkButtonStyle}" 
                                 Command="{Binding NavigationHelper.NavigateCommand}" 
                                 CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Tag}" 
                                 Tag="https://www.grapecity.com/en/download/ultimate" 
                                 Background="#faab18"
                                 Grid.Column="4" />
                <AutoSuggestBox PlaceholderText="{Binding Source={StaticResource ControlExplorerLocalization}, Path=PlaceHolder_Text}" FontStyle="Italic" Opacity="0.7" UpdateTextOnSelect="False" x:Name="controlsSearchBox" QuerySubmitted="controlsSearchBox_QuerySubmitted" TextChanged="AutoSuggestBox_TextChanged" QueryIcon="Find" Margin="5 0 10 0" VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="6">
                    <AutoSuggestBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}" />
                        </DataTemplate>
                    </AutoSuggestBox.ItemTemplate>
                </AutoSuggestBox>
            </Grid>
        </Border>
        <Frame Grid.Row="1" x:Name="frame">
            <Frame.ContentTransitions>
                <TransitionCollection>
                    <NavigationThemeTransition>
                        <NavigationThemeTransition.DefaultNavigationTransitionInfo>
                            <EntranceNavigationTransitionInfo />
                        </NavigationThemeTransition.DefaultNavigationTransitionInfo>
                    </NavigationThemeTransition>
                </TransitionCollection>
            </Frame.ContentTransitions>
        </Frame>
        <Grid Grid.Row="2" Margin="20 10" Width="250" HorizontalAlignment="Right" VerticalAlignment="Bottom">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <!--<RowDefinition Height="Auto" />-->
            </Grid.RowDefinitions>
            <Image Source="ms-appx:///Assets/grapecity_150.png" Stretch="None" HorizontalAlignment="Left"/>
            <!--<TextBlock FontSize="8" FontWeight="Bold" HorizontalAlignment="Left" TextWrapping="Wrap" Grid.Row="1">
                <TextBlock.Inlines>
                    <Run Text="{Binding Source={StaticResource ControlExplorerLocalization}, Path=Copyright_Text}" />
                    <Run Text="&#x000A;" />
                    <Run Text="{Binding Source={StaticResource ControlExplorerLocalization}, Path=Trademarks_Text}" />
                </TextBlock.Inlines>
            </TextBlock>-->
        </Grid>
    </Grid>
</Page>
