Windows Phone 8.1应用程序ProgressRing未显示

时间:2015-05-02 09:45:07

标签: windows xaml

我正在尝试在存储数据时显示进度,但我无法显示它。我的Xaml看起来如下:

 <Page
    x:Class="MyApp.MyPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Model="using:MyApp.Model"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.BottomAppBar>
        <CommandBar Height="58">
            <AppBarButton Icon="Save" Label="" Click="AddAppBarButton_Click"/>
        </CommandBar>
    </Page.BottomAppBar>


    <Grid x:Name="LayoutRoot">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Title Panel -->
        <StackPanel Grid.Row="0" Margin="19,0,0,0">
            <TextBlock Text="Name" Style="{ThemeResource BaseTextBlockStyle}" Margin="0,12,0,0"/>
            <TextBox x:Name="nameTextBox" Margin="0,10,21.833,0" />
            <TextBlock Text="Item" Style="{ThemeResource BaseTextBlockStyle}" Margin="0,12,-4.167,0"/>
            <TextBox x:Name="itemTextBox" Margin="0,10,96.833,0" PlaceholderText="" Grid.ColumnSpan="2" />
                <AppBarButton Grid.Column="1" HorizontalAlignment="Left" Icon="AddFriend" Label="" Margin="88.167,-2,0,0" VerticalAlignment="Top" Height="66" Click="ItemAppBarButton_Click"/>
            <Grid Margin="0,0,-0.167,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
            </Grid>
            <ListView x:Name="ItemListView" Height="379" Margin="0,10,21.833,0" IsItemClickEnabled="True" ItemClick="ItemListView_ItemClick">
                <ListView.DataContext>
                    <Model:Person/>
                </ListView.DataContext>
            </ListView>
        </StackPanel>
        <ProgressRing Name="BusyProgressRing" HorizontalAlignment="Left" Margin="169,299,0,0" VerticalAlignment="Top"/>
    </Grid>
</Page>

当我这样做时:

BusyProgressRing.IsActive = true;

没有显示。因为在我的成员函数结束时我做了一个BusyProgressRing.IsActive = false;并且只有在我的整个功能完成后才会出现环的渲染。

有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

测试了您的代码并且ProgressRing正常工作。我确实删除了边距并更正了代码中某些UI元素的行/列位置问题并添加了

IsActive = "True"

到ProgressRing。在我的桌面上测试时,您的原始代码(带边距)会将ProgressRing置于可见区域之外。