0

i really failed to understand why my thumbnail image is not displaying. . i am displaying the image from the google book api. can somebody help me with the issue . here is the relevant code.

one confusion : i need to create a bitmap image and assign my uri to it in the converter? will it not work without setting string with the image source?

  <DataTemplate x:Key="BooksItemTemplate">
        <Grid DataContext="{Binding}" Margin="{StaticResource PhoneTouchTargetOverhang}" Background="Transparent">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Name="btnAnswer4"> // problem is here
                <Image Name="thumbnailimage" Source="{Binding Images}" Width="110" Height="150" VerticalAlignment="Top"/>
            </Button>

            <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"                                  
                                 ItemTemplate="{StaticResource BooksItemTemplate}"/>

here is my repository class

  public class BookCategoriesRepository 
{

    private List<BookCategories> bookcategoriesList = new List<BookCategories>();
    public BookCategoriesRepository()
    {
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 1, CategoryId = 1, Identificationno = "ASDDDD", BookId = 1, BookTitle = "The power of art", Images = "http://bks1.books.google.com/books?id=mKbrGAAACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 2, CategoryId = 1, Identificationno = "ASDDDD1", BookId = 2, BookTitle = "Barto ´k, Hungary, and the Renewal of Tradition", Images = "http://bks1.books.google.com/books?id=mKbrGAAACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 3, CategoryId = 1,  Identificationno = "ASDDDD2", BookId = 3, BookTitle = "America Is the Prison", Images = "http://bks0.books.google.com/books?id=a3yRlKxxDtkC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 4, CategoryId = 1,  Identificationno = "ASDDDD3", BookId = 4, BookTitle = "Variations on a Blue Guitar", Images = "http://bks5.books.google.com/books?id=TKKd0TaNInAC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 5, CategoryId = 1,  Identificationno = "ASDDDD4", BookId = 5, BookTitle = "Sponsorship", Images = "http://bks7.books.google.com/books?id=VlON_hK0fVEC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 6, CategoryId = 1,  Identificationno = "ASDDDD5", BookId = 6, BookTitle = "I sensi delle arti", Images = "http://bks7.books.google.com/books?id=P7_pAAAAMAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 7, CategoryId = 1,  Identificationno = "ASDDDD6", BookId = 7, BookTitle = "Mahler's Fourth Symphony", Images = "http://bks1.books.google.com/books?id=ybNqORIKIekC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 8, CategoryId = 1,  Identificationno = "ASDDDD7", BookId = 8, BookTitle = "The Commissariat of Enlightenment", Images = "http://bks0.books.google.com/books?id=a3yRlKxxDtkC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 9, CategoryId = 1,  Identificationno = "ASDDDD8", BookId = 9, BookTitle = "Smallest Giant", Images= "http://bks5.books.google.com/books?id=TKKd0TaNInAC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 10, CategoryId = 1, Identificationno = "ASDDDD9", BookId = 10, BookTitle = "Dame Joan Hammond", Images = "http://bks7.books.google.com/books?id=VlON_hK0fVEC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 11, CategoryId = 1, Identificationno = "ASDDDD10", BookId = 11, BookTitle = "Star Trek and Philosophy", Images = "http://bks1.books.google.com/books?id=ybNqORIKIekC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 12, CategoryId = 1, Identificationno = "ASDDDD11", BookId = 12, BookTitle = "Manejo De Conflictos Desde La Sabiduria Del Cine Y Las Canciones", Images = "http://bks0.books.google.com/books?id=a3yRlKxxDtkC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 13, CategoryId = 2, Identificationno = "ASDDDD12", BookId = 13, BookTitle = "Smallest Giant", Images = "http://bks5.books.google.com/books?id=TKKd0TaNInAC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });
        bookcategoriesList.Add(new BookCategories() { BookcategoryId = 14, CategoryId = 2, Identificationno = "ASDDDD13", BookId = 14, BookTitle = "Afropolis", Images = "http://bks7.books.google.com/books?id=VlON_hK0fVEC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api" });

    }

  public class BookCategories 
{
    private long _BookcategoryId { get; set; }
    public long BookcategoryId
    {
        get
        {
            return _BookcategoryId;
        }
        set
        {
            _BookcategoryId = value;              
        }
    }



    private long _BookId { get; set; }
    public long BookId
    {
        get
        {
            return _BookId;
        }
        set
        {
            _BookId = value;
        }
    }



    private long _CategoryId { get; set; }
    public long CategoryId
    {
        get
        {
            return _CategoryId;
        }
        set
        {
            _CategoryId = value;
        }
    }



    private string _BookTitle { get; set; }
    public string BookTitle
    {
        get
        {
            return _BookTitle;
        }
        set
        {
            _BookTitle = value;
        }
    }



    private string_Image { get; set; }
    public string Images
    {
        get
        {
            return _Image;
        }
        set
        {
            _Image = value;               
        }
    }



    private string _Identificationno { get; set; }
    public string Identificationno
    {
        get
        {
            return _Identificationno;
        }
        set
        {
            _Identificationno = value;
        }
    }


}

here is xaml.cs page method

   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;
    }
4

1 回答 1

0

有时它可能是由错误的日期+时间配置引起的。

于 2014-12-04T15:30:52.847 回答