<Page
    x:Class="APKInstaller.Pages.MainPage"
    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:helper="using:APKInstaller.Helpers"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    NavigationCacheMode="Enabled"
    mc:Ignorable="d">
    <Page.Background>
        <SolidColorBrush x:Name="RootBackground" Color="{ThemeResource SolidBackgroundFillColorBase}" />
    </Page.Background>
    <Grid x:Name="Root">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <ReorderThemeTransition />
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.BackgroundTransition>
            <BrushTransition />
        </Grid.BackgroundTransition>
        <Grid
            x:Name="CustomTitleBar"
            Grid.Column="1"
            Height="{x:Bind helper:UIHelper.TitleBarHeight}"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Top"
            SizeChanged="CustomTitleBar_SizeChanged">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <ImageIcon
                x:Name="Icon"
                Grid.Column="0"
                MaxWidth="16"
                MaxHeight="16"
                Margin="16,0"
                VerticalAlignment="Center"
                x:Load="{x:Bind helper:UIHelper.TitleBarExtended}"
                Source="/Assets/256x256.png"
                Visibility="{x:Bind CoreAppFrame.CanGoBack, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
            <TextBlock
                x:Name="AppTitle"
                Grid.Column="1"
                Margin="0,0,16,2"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                x:Load="{x:Bind helper:UIHelper.TitleBarExtended}"
                Foreground="{ThemeResource TitleBarForegroundBrush}"
                Style="{StaticResource CaptionTextBlockStyle}"
                Text="{x:Bind GetAppTitleFromSystem}"
                TextTrimming="CharacterEllipsis"
                TextWrapping="NoWrap"
                Visibility="{x:Bind CoreAppFrame.CanGoBack, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
        </Grid>
        <Border
            x:Name="AboutButtonBorder"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            Canvas.ZIndex="1"
            Visibility="{x:Bind CoreAppFrame.CanGoBack, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter='true'}">
            <Button
                x:Name="AboutButton"
                x:Uid="/TitleBar/AboutButton"
                Width="{x:Bind helper:UIHelper.TitleBarHeight}"
                Height="{x:Bind helper:UIHelper.TitleBarHeight}"
                Padding="0"
                Click="Button_Click"
                FocusVisualMargin="0"
                IsTabStop="True"
                Style="{StaticResource TitleBarSettingsButtonStyle}" />
        </Border>
        <Frame
            x:Name="CoreAppFrame"
            Grid.Row="1"
            Grid.ColumnSpan="3"
            x:FieldModifier="Public" />
    </Grid>
</Page>
