-3

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

谢谢

4

1 回答 1

0

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>

C#

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    VisualStateManager.GoToState(this, "Dark", true);

    //TODO: Load Data

    VisualStateManager.GoToState(this, "Normal", true);
}
于 2013-04-29T11:02:57.763 回答