Xaml Windows应用商店应用程序-黑屏过渡一段时间

Xaml Windows应用商店应用程序-黑屏过渡一段时间,xaml,windows-8,windows-runtime,microsoft-metro,windows-store-apps,Xaml,Windows 8,Windows Runtime,Microsoft Metro,Windows Store Apps,在我的应用程序页面之间导航时出现问题。 从“a”页转到“b”页,在看到“b”页之前的一秒钟,我看到了一个黑屏。它也发生在相反的导航中。 我知道这个问题也很常见,但我不知道如何解决它…而且它很难看 编辑:只是一个重要信息:我已经设置了一个自定义图像作为两个页面(a,b)的背景…正如您在代码“Assets/Page.jpg”中看到的那样 这是我的基本页面“a”XAML: 最后,我在OnLaunched方法的App.xaml.cs中应用了一种变通方法,只需将这几行放在白屏过渡(而不是黑屏!): 您

在我的应用程序页面之间导航时出现问题。 从“a”页转到“b”页,在看到“b”页之前的一秒钟,我看到了一个黑屏。它也发生在相反的导航中。 我知道这个问题也很常见,但我不知道如何解决它…而且它很难看

编辑:只是一个重要信息:我已经设置了一个自定义图像作为两个页面(a,b)的背景…正如您在代码“Assets/Page.jpg”中看到的那样

这是我的基本页面“a”XAML:



最后,我在OnLaunched方法的App.xaml.cs中应用了一种变通方法,只需将这几行放在白屏过渡(而不是黑屏!):


您可以使用
app.xaml
中的
RequestedTheme
属性来更改默认主题。选项是黑暗和光明的主题。选择其中一个也会更改文本颜色和默认过渡

<Page
x:Class="BlankApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BlankApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
    <Style x:Key="ButtonStyle2" TargetType="Button">
        <Setter Property="Background" Value="{StaticResource ButtonBackgroundThemeBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ButtonForegroundThemeBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ButtonBorderThemeBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource ButtonBorderThemeThickness}"/>
        <Setter Property="Padding" Value="12,4,12,4"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="PointerOver" />
                                <VisualState x:Name="Pressed" >
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="Background">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPointerOverBackgroundThemeBrush}" />
                                    </ObjectAnimationUsingKeyFrames>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPointerOverForegroundThemeBrush}" />
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledBackgroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledBorderThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />                                        
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="PointerFocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="3">
                            <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        <Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="1.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" StrokeDashArray="1,1"/>
                        <Rectangle x:Name="FocusVisualBlack" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="0.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" StrokeDashArray="1,1"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>             
</Page.Resources>

<Grid Style="{StaticResource LayoutRootStyle}">
    <Grid.Background>
        <ImageBrush ImageSource="Assets/Page.jpg"/>
    </Grid.Background>
    <Button Margin="299,0,0,92" Width="160" Height="141" Click="Insert_Click" BorderBrush="White" Background="#00170C0C" Style="{StaticResource ButtonStyle2}" HorizontalAlignment="Left" BorderThickness="0" VerticalAlignment="Bottom" />
    <Button Margin="129,0,0,92" Width="160" Height="141" Click="Search_Click" Background="#00170C0C" BorderBrush="White" Style="{StaticResource ButtonStyle2}" HorizontalAlignment="Left" BorderThickness="0" VerticalAlignment="Bottom"/> 
</Grid>
rootFrame = new Frame();
SolidColorBrush scb = new SolidColorBrush();
scb.Color = Colors.White;
rootFrame.Background = scb;