开发者

How to know when all controls and templates are loaded (Windows Phone 7)

I am trying to lazy load the Image Source for the Image Control but the problem is that I have to wait for all controls loaded so that I can use VisualTreeHelper to access to the Image control (which inside a datatemplate).

I tried with Loaded event, LayoutUpdated even, ApplyTemplate like in the manual of msdn but for all of them, when I tried to get the container for Image Control, it is null

    var containerItem = FeedsPanorama.ItemContainerGenerator.ContainerFromIndex(selectedIndex);

    var imageControl = VisualElementHelper.FindName<Image>("ImageThumbnail", containerItem);

    new ImageUtility().GetImag开发者_运维知识库eAsyn(new Uri(selectedItem.SummaryImageLink, UriKind.Absolute), imageControl);

The same code will work when I handle in Selection_Changed event of FeedsPanaroma


Have you tried the Loaded event for the page?


I tried to work around so that I don't have to deal with the Loaded Event. I wrote a new ImageConverter so that I can use that tag to replace the Image tag. It works like a charm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜