设为首页 收藏本站
查看: 864|回复: 0

Windows Phone 7Silverlight控件之--Panorama

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-5-10 10:01:50 | 显示全部楼层 |阅读模式
  Silverlight for Windows Phone 7的Pivot、Panorama控件是一个类似于Android应用程序列表中可以翻页控件,具有如下特点
  1.简单的XAML和编程接口
  
    2.完全支持数据绑定、内容模板属性和项目容器样式
  
    3.内置黑、白两种皮肤样式
  
    4.内置触控导航,可以让用户快速滑动控件并定位到指定的项
  
    5.在页面或内容项导航滑动时,提供漂亮的过渡动画
  
    6.强大的可扩展性,用户可通过事件、可视化状态和重新定义模板的方式扩展功能。
  
  今天这一讲是Panorama的如何使用
  一、重要属性和方法
  1.说明  
  Panorama提供了可以创建翻页的全景视图。
  2.重要属性  
  public object DefaultItem:获取或设置Panorama的默认Item
  SelectedIndex:获取或设置被选中的PanoramaItem的索引
  SelectedItem:获取或设置被选中的PanoramatItem
  Title:获取或设置Panorama的标题
  3.重要方法
  protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e):当Panorama的Items集合改变时,通知Panorama更新Items的Header。
  
  二、应用
  1.新建项目
  图1和图2两种方法
DSC0000.png
  图1
  
DSC0001.png
  图2
  使用图2方法新建后VS将自动产生Panorama项目模板,这种方法比较简单。如下图
DSC0002.png
  图3
  2.图1步骤
  从工具箱中拖Panorama控件到视图工作区,在本例中一共有四页,第一页是一个ListBox控件,第二页是一个Ellipse控件,第三页是一个多行文本区域控件(TextBlock),第四页是一个具有动画效果的文本,我们可以通过左右滑动来进行换页,大家或许已经看出它和Pivot的差别,在一页中它可以看到部分属于第二页的东东,而且它的标题Title横跨整个Panorama布局
  
               
                    
                        
                           
                                
                           
                        
  Arial
                        Arial Black
                        Calibri
                        Comic Sans MS
                        Courier New
                        Georgia
                        Lucida Sans Unicode
                        Portable User Interface
                        Segoe WP
                        Segoe WP Black
                        Segoe WP Bold
                        Segoe WP Light
                        Segoe WP Semibold
                        Segoe WP SemiLight
                        Tahoma
                        Times New Roman
                        Trebuchet MS
                        Verdana
                        Webdings
                    
               
  
                    
                        
                           
                                
                                
                                
                           
                        
                    
               
  
                    
                    
                        
                    For a long time I used to go to bed early. Sometimes, when I had put out
                    my candle, my eyes would close so quickly that I had not even time to
                    say "I'm going to sleep." And half an hour later the thought that it was
                    time to go to sleep would awaken me; I would try to put away the book
                    which, I imagined, was still in my hands, and to blow out the light; I
                    had been thinking all the time, while I was asleep, of what I had just
                    been reading, but my thoughts had run into a channel of their own,
                    until I myself seemed actually to have become the subject of my book:
                    a church, a quartet, the rivalry between François I and Charles V. This
                    impression would persist for some moments after I was awake; it did not
                    disturb my mind, but it lay like scales upon my eyes and prevented them
                    from registering the fact that the candle was no longer burning. Then
                    it would begin to seem unintelligible, as the thoughts of a former
                    existence must be to a reincarnate spirit; the subject of my book would
                    separate itself from me, leaving me free to choose whether I would form
                    part of it or no; and at the same time my sight would return and I
                    would be astonished to find myself in a state of darkness, pleasant and
                    restful enough for the eyes, and even more, perhaps, for my mind, to
                    which it appeared incomprehensible, without a cause, a matter dark
                    indeed.
                        
                    
               
  
                    
               
                    
               
  
  
                        
                           
                                
                                    
  
  
                                
                           
                        
                    
               
            
  效果如图
DSC0003.png    DSC0004.png
  3.数据绑定
  1)数据源类Datas.cs
  public static class Datas
    {
        public static List GetDatas()
        {
            List list = new List();
            list.Add("salam");
            list.Add("Aiming Zhang");
            return list;
        }
    }
  
  2)MainPage.cs
  public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            this.panorama.ItemsSource = Datas.GetDatas();
        }
    }
  效果如图
DSC0005.png    DSC0006.png

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-65407-1-1.html 上篇帖子: Windows Phone 7开发,进度条ProgressBar使用详解 下篇帖子: Windows Phone 7/ Silverlight MD5加密实现方法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表