<Page x:Name="pageRoot" x:Class="ControlExplorer.HomePage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ControlExplorer"
    xmlns:data="using:ControlExplorer.Data"
    xmlns:common="using:ControlExplorer.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
        <ResourceDictionary>
            <!-- Collection of items displayed by this page -->
            <CollectionViewSource
                x:Name="itemsViewSource"
                Source="{Binding Items}"
                d:Source="{Binding Controls, Source={d:DesignInstance Type=data:SampleDataSource, IsDesignTimeCreatable=True}}"/>
            <CollectionViewSource
                x:Name="newFeaturesViewSource"
                Source="{Binding NewFeatures}" />
        </ResourceDictionary>
    </Page.Resources>

    <Grid Background="{ThemeResource ControlExplorerBackgroundThemeBrush}">
        <Border Background="{ThemeResource ControlExplorerLightStripeThemeBrush}" Height="60" VerticalAlignment="Top" Margin="0 80 0 0"/>
        <Pivot>
            <Pivot.Title>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
                    <Image x:Name="logo" Source="/Resources/images/logo_Studio_UWP_0215.png" Height="70" Margin="-12 -12 -12 0"/>
                </StackPanel>
            </Pivot.Title>
            <PivotItem VerticalContentAlignment="Stretch" Header="About">
                <Border Margin="12 20 12 0" VerticalAlignment="Stretch">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition />
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock Text="2015 v3" Foreground="Gray" Style="{ThemeResource SubtitleTextBlockStyle}" />
                        <TextBlock Text="UI and Data Visualization Controls for UWP" Grid.Row="1" Style="{ThemeResource TitleTextBlockStyle}" TextWrapping="Wrap"/>
                        <TextBlock Margin="0 12" Grid.Row="2" TextWrapping="Wrap">
                            Get UI controls for data visualization, document viewing, text editing, and more inside ComponentOne Studio® UWP Edition. 
                            <LineBreak/><LineBreak/>Designed for modern user interfaces and touch-first user experiences, the unique functionality of these controls gives you the power to build better and more compelling UWP apps.
                        </TextBlock>
                        <TextBlock Grid.Row="3"><Hyperlink NavigateUri="http://www.componentone.com" FontSize="15" Foreground="{ThemeResource ControlExplorerHyperlinkThemeBrush}" FontWeight="Bold">Download C1 Studio UWP Edition</Hyperlink></TextBlock>
                    </Grid>
                </Border>
            </PivotItem>
            <PivotItem Header="What's New" >
                <local:C1GridView ItemsSource="{Binding Source={StaticResource newFeaturesViewSource}}" 
                                  x:Name="newFeaturesGridView" SelectionMode="None" IsItemClickEnabled="True"
                                  Margin="0 20 0 0" Padding="0" ItemClick="newFeaturesGridView_ItemClick">
                    <GridView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VariableSizedWrapGrid Orientation="Vertical" ItemWidth="140" ItemHeight="140" MaximumRowsOrColumns="3"/>
                        </ItemsPanelTemplate>
                    </GridView.ItemsPanel>
                    <GridView.ItemContainerStyle>
                        <Style TargetType="GridViewItem">
                            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                            <Setter Property="Margin" Value="0 0 10 10" />
                        </Style>
                    </GridView.ItemContainerStyle>
                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <Border BorderBrush="#FF2C383D" BorderThickness="2">
                                <Grid>
                                    <Image Source="{Binding ImageSource}" Stretch="UniformToFill" />
                                    <Border VerticalAlignment="Bottom" Background="#FF2C383D">
                                        <TextBlock Text="{Binding Title}" Foreground="White" FontFamily="Segoe WP" FontSize="18" VerticalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap" Margin="2"/>
                                    </Border>
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                </local:C1GridView>
            </PivotItem>
            <PivotItem x:Name="ControlsHub" Header="Controls">
                <GridView Padding="0" x:Name="itemGridView" RequestedTheme="Dark"
                    AutomationProperties.AutomationId="ItemsGridView"
                    AutomationProperties.Name="Items"
                    ItemTemplate="{StaticResource Standard100x100ItemTemplate}"
                    ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
                    Style="{StaticResource narrowLayoutGridView}"
                    SelectionMode="None" Margin="0 20 0 0" IsItemClickEnabled="True"
                    ItemClick="ItemView_ItemClick" />
            </PivotItem>
        </Pivot>
    </Grid>
</Page>
