Windows 8 Windows8-数据加载层

Windows 8 Windows8-数据加载层,windows-8,windows-runtime,winrt-xaml,Windows 8,Windows Runtime,Winrt Xaml,我想阻止应用程序,并显示一个黑色或黑色透明层,带有ProgressRing,显示应用程序正在加载数据 谢谢XAML <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> <!-- Data will be loaded in GridView --> <GridView /> <!-- Black layer with progress

我想阻止应用程序,并显示一个黑色或黑色透明层,带有ProgressRing,显示应用程序正在加载数据

谢谢

XAML

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

    <!-- Data will be loaded in GridView -->
    <GridView />

    <!-- Black layer with progress ring -->
    <Border x:Name="border" BorderBrush="Black" BorderThickness="1" Opacity="0.95" Background="Black" Visibility="Collapsed">
        <ProgressRing HorizontalAlignment="Center" VerticalAlignment="Center" IsActive="True" Width="100" Height="100" />
    </Border>

    <!-- Visual state will switch black layer and GridView -->
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState x:Name="Normal" />
            <VisualState x:Name="Dark">
                <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="border">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
</Grid>
它工作得很好:)谢谢
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    VisualStateManager.GoToState(this, "Dark", true);

    //TODO: Load Data

    VisualStateManager.GoToState(this, "Normal", true);
}