PivotViewer在Silverlight5中显示图片方法

PivotViewer 控件使您能够以容易被用户使用的方式一次性显示大量数据。用户可以以帮助其查看趋势并快速找到他们所需信息的方式来浏览数据.

 

PivotViewer 显示效果确实不错,普通应用方式可以参考 MSDN帮助PivotViewer的使用 ,但当使用大量图片绑定模版时,会造成Silverlight页面卡死,并占用大量内存,原因是图片还是一次性加载,并不是一个一个加载.

要想分布加载,可以使用老方式 – CXML

Cxml与PivotViewer绑定

      private CxmlCollectionSource cxml;
      private void InitializePivotViewer()
      {
          string cxamName = string.Empty;
          if (!App.Current.Host.InitParams.TryGetValue("CXMLNAME", out cxamName))
          {
              return;
          }

          var source = Application.Current.Host.Source;
          string url = string.Format("http://{0}:{1}/{2}", source.Host, source.Port, cxamName);

          cxml = new CxmlCollectionSource(new Uri(url, UriKind.Absolute));
          cxml.StateChanged += _cxml_StateChanged;
      }

      void _cxml_StateChanged(object sender, CxmlCollectionStateChangedEventArgs e)
      {
          if (e.NewState == CxmlCollectionState.Loaded)
          {
              pivotViewer.PivotProperties = cxml.ItemProperties.ToList();
              pivotViewer.ItemTemplates = cxml.ItemTemplates;
              pivotViewer.ItemsSource = cxml.Items;
          }
      }

 

 

CXML 生成方式,可以是用开源的库.

PivotServerTools.dll

https://preview.nuget.org/packages/pivotserverlib/1.0/Contents

 

 Demo下载

 

 


 

转载于:https://www.cnblogs.com/kaito/archive/2012/11/28/2792507.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值