locked
show gridviewitem only when it is ready?

    Question

  • I use grid view to display images (I just have url to image).

    Something like:

    <DataTemplate>
    <Grid>
    <Image Grid.Row="1"  Source="{Binding Path=image_url}"/>
    </Grid>
    </DataTemplate>
    

    Currently, they all show up at same time, no matter image is loaded or not.

    My question is can I do something to let gridviewitem show only when the image is fully loaded?

    Thanks,

    Helin

    Monday, November 19, 2012 11:55 PM

Answers

  • If your image is downloaded from internet, then you could declare one BitmapImage, and add one event handler for its DownloadProgress event. And you could check the progress with 100 value, then could set one Visibility property to visible to show the Image element. Also, in XAML, you could bind the Image element visibility property with the behind  Visibility property. 

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Helin Wang Wednesday, November 21, 2012 3:18 AM
    Wednesday, November 21, 2012 3:10 AM

All replies

  • If your image is downloaded from internet, then you could declare one BitmapImage, and add one event handler for its DownloadProgress event. And you could check the progress with 100 value, then could set one Visibility property to visible to show the Image element. Also, in XAML, you could bind the Image element visibility property with the behind  Visibility property. 

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Helin Wang Wednesday, November 21, 2012 3:18 AM
    Wednesday, November 21, 2012 3:10 AM
  • Bob, thanks for the approach.
    Wednesday, November 21, 2012 3:18 AM