我正在尝试在Windows Mobile 8.0中将ProgressIndicator用于页面加载指示,但无法在正确的阶段显示进度条。
我的代码:
<shell:SystemTray.ProgressIndicator>
<shell:ProgressIndicator IsIndeterminate="false" IsVisible="True" x:Name="progres"/>
</shell:SystemTray.ProgressIndicator>
并在按钮的事件处理程序中放入
private void Scalefind_Click(object sender, RoutedEventArgs e)
{
progres.IsIndeterminate = true;
NavigationService.Navigate(new Uri("/Scales.xaml", UriKind.Relative));
progres.IsIndeterminate = false;
}
但指标并未显示。如果我评论progres.IsIndeterminate = 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>
答案 0 :(得分:0)
我在诺基亚开发者网站上找到了解决方案,它正如我所需的那样工作。
Custom splash screen with progress bar for Windows Phone applications