2013-09-22 69 views
0

我正在訪問谷歌圖書API來顯示在我的書結果頁面縮略圖在我app.The事情我想要做的是當用戶訪問的書單,我立刻想顯示「從我的圖片文件夾中加載'png圖片,因爲從谷歌圖書API中加載縮略圖需要一些時間。然後逐個原始縮略圖圖像將加載到加載圖像上,給用戶帶來不錯的體驗。事情是,我如何重新綁定圖像(即加載加載圖像後,我想加載真正的縮略圖)?這裏是相關的代碼。任何想法如何以適當的方式做到這一點?的Windows Phone 8 longlistselector重新綁定圖像

如果使用轉換器我不確定如何識別哪個圖像顯示時?

<DataTemplate x:Key="BooksItemTemplate"> 
     <Grid Margin="{StaticResource PhoneTouchTargetOverhang}" Background="Transparent"> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition Width="Auto"/> 
       <ColumnDefinition Width="*"/> 
      </Grid.ColumnDefinitions> 
      <Button Click="Button_Click_1" /> 
      <Image Source="Images/loading.jpg" Height="150" Width="150"/> 
      <StackPanel Grid.Column="1" VerticalAlignment="Top"> 
       <TextBlock Text="{Binding BookTitle}" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" FontFamily="{StaticResource PhoneFontFamilySemiBold}"/> 
       <TextBlock Text="{Binding Identificationno}" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" FontFamily="{StaticResource PhoneFontFamilySemiLight}"/> 
      </StackPanel> 
     </Grid> 
    </DataTemplate> 

<phone:LongListSelector x:Name="bookslist" 
           Background="Transparent" 
           IsGroupingEnabled="False"     
           ItemTemplate="{StaticResource BooksItemTemplate}"/> 


public BookCategoriesViewModel bookcategoriesvm; 
    public BooksListing() 
    { 
     InitializeComponent(); 
     bookcategoriesvm = new BookCategoriesViewModel(); 
    } 

    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) 
    { 
     base.OnNavigatedTo(e); 
     string categoryid = string.Empty; 
     if (NavigationContext.QueryString.TryGetValue("catid", out categoryid)) 
     { 
      bookcategoriesvm.GetBookcategories(Convert.ToInt64(categoryid));    
     } 

     bookslist.ItemsSource = bookcategoriesvm.BooksCategoriesList; 
    } 

回答

1

最簡單的可能只是有兩個圖像彼此(以下簡稱「加載圖片」在底部)的頂部像這樣每當縮略圖完成下載,它只會隱藏加載圖片。