簡體   English   中英

如何在Windows Phone中顯示加載阻止程序視圖?

[英]How to show loading blocker view in windows phone?

我想在任何HTTP請求發送到服務器或執行任何異步操作時顯示加載阻止程序視圖。

主要目標是有時我們想停止最終用戶與App UI的交互,直到操作完成。

在Android世界中,我將調用ProgressDialog,它使屏幕變暗,並且特定於手機的微調器動畫以及我想要在屏幕中間顯示的任何消息。

我知道在Windows Phone中,我們可以選擇在系統任務欄中指示進程

            ProgressIndicator progress = new ProgressIndicator
            {
                IsVisible = true,
                IsIndeterminate = true,
                Text = "Connecting to server..." //TODO:Locale
            };
            SystemTray.SetProgressIndicator(this, progress);

但是,我想通過在該視圖中添加視圖和自己的加載器動畫來阻止UI交互。

我們可以從整個應用程序中調用相同的視圖嗎?

謝謝。

您可以使用覆蓋所有頁面的網格並通過屬性控制其可見性

<Grid  Visibility="{Binding Path=YourGrid.LoadingVisibility,Source={StaticResource Locator}, UpdateSourceTrigger=Default,Mode=TwoWay}"   x:Name="OverlayGrid" Grid.Row="0" Background="Transparent" Grid.Column="0" Grid.RowSpan="11" Grid.ColumnSpan="3" Style="{StaticResource PortraitGridStyle}">

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Border Background="White" Opacity="0.4"></Border>
        <ProgressBar IsIndeterminate="True" HorizontalAlignment="Center" Foreground="Black"  VerticalAlignment="Center" Width="400" Height="10" />
    </Grid>

此示例具有Windows Phone中的默認動畫,其中使用進度條控件在其中浮動了5個點

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM