在ItemsPage中下载图像时显示ProgressRing

时间:2013-04-18 23:07:41

标签: c# xaml windows-8 windows-store-apps

我有一个ItemsPage。 当用户导航时,应用程序下载少量图像。 我想在每一个上看到ProgressRing。

我的GridViewTemplate

<GridView.ItemTemplate>
  <DataTemplate>
    <Grid HorizontalAlignment="Left"
          Width="150"
          Height="230">
      <Canvas>
        <ProgressRing x:Name="imageProgress"
                      Canvas.ZIndex="10"
                      Width="100"
                      Height="100"
                      HorizontalAlignment="Left"
                      Grid.Column="0" />
        <Image x:Name="FilmImage"
               Source="{Binding Image}"
               Stretch="UniformToFill"
               AutomationProperties.Name="{Binding Title}" />
      </Canvas>
      <StackPanel VerticalAlignment="Bottom"
                  Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
        <TextBlock Text="{Binding Title}"
                   Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}"
                   Style="{StaticResource TitleTextStyle}"
                   Height="60"
                   Margin="15,0,15,0" />
        <TextBlock Text="{Binding Subtitle}"
                   Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}"
                   Style="{StaticResource CaptionTextStyle}"
                   TextWrapping="NoWrap"
                   Margin="15,0,15,10" />
      </StackPanel>
    </Grid>
  </DataTemplate>
</GridView.ItemTemplate>

我的.cs

 public sealed partial class AllCinemas : LayoutAwarePage
    {
protected async override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {

            FeedAllCinemas allCinemas = new FeedAllCinemas();
            allCinemas.GetAllCinemas("", "");
            this.DefaultViewModel["Items"] = allCinemas.Cinemas;
        }
}

2 个答案:

答案 0 :(得分:3)

请查看这篇精彩的博文,它正是您想要的:Windows 8 (or XAML generally): Loading Images with Progress/Fallback Content

enter image description here

答案 1 :(得分:1)