读书人

Windows Phone Pivot 模拟 滑动Image

发布时间: 2013-01-19 11:41:36 作者: rapoo

Windows Phone Pivot 模拟 滑动Image Viewer 出现 0x8000ffff 异常
简介: App有多张图片需要展示,打算做一个 类似于 “图片”里面可以滑动的 图片展示页面。 实现的方式有很多。选个简单的,直接用Pivot来模拟。
问题: 过程中出现了:0x8000ffff 异常!!! 我将 ObservableCollection<Uri> 绑定到 ItemTemplete,并且设置ItemSource时候引发0x8000ffff 异常。完全没有头绪。

使用的代码:
代码如下:数据

 public ObservableCollection<BitmapImage> Images { get; set; }  protected override void OnNavigatedTo(NavigationEventArgs e)        {            base.OnNavigatedTo(e);            UmengSDK.UmengAnalytics.onPageStart("ImageViewerPage");            if (PhoneApplicationService.Current.State.ContainsKey("images"))            {                object list;                if (PhoneApplicationService.Current.State.TryGetValue("images", out list))                {                                        ImageUris = list as ObservableCollection<Uri>;                 }            }            Images.Clear();            foreach (var uri in ImageUris)            {                BitmapImage bitmap = new BitmapImage();                bitmap.CreateOptions = BitmapCreateOptions.BackgroundCreation;                // 当图片下载完成并解码成功时,会触发ImageOpened                bitmap.ImageOpened += (s, ex) =>                {                    // 添加到图片列表                    Images.Add(s as BitmapImage);                 };                // uri为远程文件地址                bitmap.UriSource = uri;             }            int index = int.Parse(NavigationContext.QueryString["index"]);            Pivot.SelectedIndex = index;            Pivot.ItemsSource = Images;        }


咔嗒!成了!



历史

读书人网 >图形图像

热点推荐