Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WP8如何在页面加载时使用ProgressIndicator_C#_Xaml_Windows Phone 8 - Fatal编程技术网

C# WP8如何在页面加载时使用ProgressIndicator

C# WP8如何在页面加载时使用ProgressIndicator,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我试图将ProgressIndicator用于Windows Mobile 8.0中的页面加载指示,但无法在正确的阶段显示进度条 我的代码: <shell:SystemTray.ProgressIndicator> <shell:ProgressIndicator IsIndeterminate="false" IsVisible="True" x:Name="progres"/> </shell:SystemTray.ProgressIndicator&

我试图将ProgressIndicator用于Windows Mobile 8.0中的页面加载指示,但无法在正确的阶段显示进度条

我的代码:

<shell:SystemTray.ProgressIndicator>
    <shell:ProgressIndicator IsIndeterminate="false"  IsVisible="True" x:Name="progres"/>
</shell:SystemTray.ProgressIndicator>
但指示灯并没有显示出来。如果我对
progres.isindedite=false进行注释
当我返回页面时,进度条显示

我无法找到如何显示进度条,当我点击按钮,直到页面加载

谢谢你的帮助

Scales.xmal

<phone:PhoneApplicationPage
    x:Class="Scale_Finder.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Landscape" Orientation="Landscape"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False" Unloaded="PhoneApplicationPage_Unloaded" Loaded="PhoneApplicationPage_Loaded">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="110"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,8">
            <TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle2Style}"/>
        </StackPanel>

        <StackPanel Name="Notes" Grid.Row="1" Orientation="Horizontal">
            <toolkit:ListPicker x:Name="D1" Header="{Binding Path=LocalizedResources.D1, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D1Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D2" Header="{Binding Path=LocalizedResources.D2, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D2Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D3" Header="{Binding Path=LocalizedResources.D3, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D3Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D4" Header="{Binding Path=LocalizedResources.D4, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D4Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D5" Header="{Binding Path=LocalizedResources.D5, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D5Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D6" Header="{Binding Path=LocalizedResources.D6, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D6Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D7" Header="{Binding Path=LocalizedResources.D7, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D7Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>

            <StackPanel Orientation="Vertical">
                <Button x:Name="FindScalesBtn" Content="{Binding Path=LocalizedResources.FindscalesButtonText, Source={StaticResource LocalizedStrings}}" Click="FindScaleClick" Margin="0,0,0,0" FontSize="18" BorderThickness="1"/>
                <Button x:Name="ClearBtn" Content="{Binding Path=LocalizedResources.ClearButtonText, Source={StaticResource LocalizedStrings}}" Click="ClearClick" Margin="0,0,0,0" FontSize="18" BorderThickness="1"/>
            </StackPanel>

            <toolkit:ListPicker x:Name="Ariza" Header="{Binding Path=LocalizedResources.Ariza, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.ArizaHeader, Source={StaticResource LocalizedStrings}}" ExpansionMode="FullScreenOnly" SelectionChanged="AccidentalsSelectionChanged">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="52"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <ScrollViewer Grid.Row="3" Name="StandartScalesViewer" VerticalScrollBarVisibility="Visible" ManipulationMode="Control">
            <StackPanel x:Name="StandartScalesStackPanel" Orientation="Vertical">
                <ListBox x:Name="ScaleOutput">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" FontFamily="Courier New"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ScrollViewer>

        <ScrollViewer Grid.Row="4" Name="CustomScalesVivewer" VerticalScrollBarVisibility="Visible" ManipulationMode="Control">
            <StackPanel x:Name="CustomScalesStackPanel" Orientation="Vertical">
                <ListBox x:Name="CustomScalesOutput">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" FontFamily="Courier New" Foreground="Blue"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ScrollViewer>
        <!--Uncomment to see an alignment grid to help ensure your controls are
            aligned on common boundaries.  The image has a top margin of -32px to
            account for the System Tray. Set this to 0 (or remove the margin altogether)
            if the System Tray is hidden.

            Before shipping remove this XAML and the image itself.-->
        <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
    </Grid>

</phone:PhoneApplicationPage>

我在诺基亚开发者网站上找到了解决方案,它完全符合我的需要


您应该在“比例”页面中将IsIndeterminate属性设置为true。当“缩放”页面完成加载内容后,您可以将其设置回false。您好,谢谢您的技巧,但找不到如何从“缩放”页面访问progres.IsIndeterminate:(我设法调用它,但没有帮助。我要从其他页面调用的代码是:public static void SetProgressIndicator(bool isVisible){SystemTray.ProgressIndicator.IsIndeterminate=isVisible;SystemTray.ProgressIndicator.isVisible=isVisible;}你只是想在导航过程中显示它吗?你想显示什么过程?我需要一些背景信息^^
<phone:PhoneApplicationPage
    x:Class="Scale_Finder.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Landscape" Orientation="Landscape"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False" Unloaded="PhoneApplicationPage_Unloaded" Loaded="PhoneApplicationPage_Loaded">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="110"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,8">
            <TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle2Style}"/>
        </StackPanel>

        <StackPanel Name="Notes" Grid.Row="1" Orientation="Horizontal">
            <toolkit:ListPicker x:Name="D1" Header="{Binding Path=LocalizedResources.D1, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D1Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D2" Header="{Binding Path=LocalizedResources.D2, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D2Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D3" Header="{Binding Path=LocalizedResources.D3, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D3Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D4" Header="{Binding Path=LocalizedResources.D4, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D4Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D5" Header="{Binding Path=LocalizedResources.D5, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D5Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D6" Header="{Binding Path=LocalizedResources.D6, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D6Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:ListPicker x:Name="D7" Header="{Binding Path=LocalizedResources.D7, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D7Header, Source={StaticResource LocalizedStrings}}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="32"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>

            <StackPanel Orientation="Vertical">
                <Button x:Name="FindScalesBtn" Content="{Binding Path=LocalizedResources.FindscalesButtonText, Source={StaticResource LocalizedStrings}}" Click="FindScaleClick" Margin="0,0,0,0" FontSize="18" BorderThickness="1"/>
                <Button x:Name="ClearBtn" Content="{Binding Path=LocalizedResources.ClearButtonText, Source={StaticResource LocalizedStrings}}" Click="ClearClick" Margin="0,0,0,0" FontSize="18" BorderThickness="1"/>
            </StackPanel>

            <toolkit:ListPicker x:Name="Ariza" Header="{Binding Path=LocalizedResources.Ariza, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.ArizaHeader, Source={StaticResource LocalizedStrings}}" ExpansionMode="FullScreenOnly" SelectionChanged="AccidentalsSelectionChanged">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" FontSize="52"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <ScrollViewer Grid.Row="3" Name="StandartScalesViewer" VerticalScrollBarVisibility="Visible" ManipulationMode="Control">
            <StackPanel x:Name="StandartScalesStackPanel" Orientation="Vertical">
                <ListBox x:Name="ScaleOutput">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" FontFamily="Courier New"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ScrollViewer>

        <ScrollViewer Grid.Row="4" Name="CustomScalesVivewer" VerticalScrollBarVisibility="Visible" ManipulationMode="Control">
            <StackPanel x:Name="CustomScalesStackPanel" Orientation="Vertical">
                <ListBox x:Name="CustomScalesOutput">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}" FontFamily="Courier New" Foreground="Blue"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ScrollViewer>
        <!--Uncomment to see an alignment grid to help ensure your controls are
            aligned on common boundaries.  The image has a top margin of -32px to
            account for the System Tray. Set this to 0 (or remove the margin altogether)
            if the System Tray is hidden.

            Before shipping remove this XAML and the image itself.-->
        <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
    </Grid>

</phone:PhoneApplicationPage>