Windows Phone 7Silverlight控件之--Panorama

 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两种方法

  

图1

 

图2

使用图2方法新建后VS将自动产生Panorama项目模板,这种方法比较简单。如下图

图3

2.图1步骤

从工具箱中拖Panorama控件到视图工作区,在本例中一共有四页,第一页是一个ListBox控件,第二页是一个Ellipse控件,第三页是一个多行文本区域控件(TextBlock),第四页是一个具有动画效果的文本,我们可以通过左右滑动来进行换页,大家或许已经看出它和Pivot的差别,在一页中它可以看到部分属于第二页的东东,而且它的标题Title横跨整个Panorama布局

   <controls:Panorama Title="panorama 演示" x:Name="panorama">
                <controls:PanoramaItem Header="ListBox">
                    <ListBox FontSize="{StaticResource PhoneFontSizeLarge}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding}"
                                   FontFamily="{Binding}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>

                        <system:String>Arial</system:String>
                        <system:String>Arial Black</system:String>
                        <system:String>Calibri</system:String>
                        <system:String>Comic Sans MS</system:String>
                        <system:String>Courier New</system:String>
                        <system:String>Georgia</system:String>
                        <system:String>Lucida Sans Unicode</system:String>
                        <system:String>Portable User Interface</system:String>
                        <system:String>Segoe WP</system:String>
                        <system:String>Segoe WP Black</system:String>
                        <system:String>Segoe WP Bold</system:String>
                        <system:String>Segoe WP Light</system:String>
                        <system:String>Segoe WP Semibold</system:String>
                        <system:String>Segoe WP SemiLight</system:String>
                        <system:String>Tahoma</system:String>
                        <system:String>Times New Roman</system:String>
                        <system:String>Trebuchet MS</system:String>
                        <system:String>Verdana</system:String>
                        <system:String>Webdings</system:String>
                    </ListBox>
                </controls:PanoramaItem>

                <controls:PanoramaItem Header="Ellipse">
                    <Ellipse>
                        <Ellipse.Fill>
                            <LinearGradientBrush>
                                <GradientStop Offset="0" Color="{StaticResource PhoneAccentColor}" />
                                <GradientStop Offset="0.5" Color="{StaticResource PhoneBackgroundColor}" />
                                <GradientStop Offset="1" Color="{StaticResource PhoneForegroundColor}" />
                            </LinearGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                </controls:PanoramaItem>

                <controls:PanoramaItem Header="TextBlock">
                    <ScrollViewer>
                   
                        <TextBlock TextWrapping="Wrap">
                    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.
                        </TextBlock>
                    </ScrollViewer>
                </controls:PanoramaItem>

                <controls:PanoramaItem Header="Animation">
                    <TextBlock Text="Hello, Windows Phone 7!"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       RenderTransformOrigin="0.5 0.5">
                <TextBlock.RenderTransform>
                    <CompositeTransform x:Name="xform" />
                </TextBlock.RenderTransform>

                    </TextBlock>

                    <controls:PanoramaItem.Triggers>
                        <EventTrigger>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Storyboard.TargetName="xform"
                                             Storyboard.TargetProperty="Rotation"
                                             From="0" To="360" Duration="0:0:3"
                                             RepeatBehavior="Forever" />

                                    <DoubleAnimation Storyboard.TargetName="xform"
                                             Storyboard.TargetProperty="TranslateX"
                                             From="0" To="300" Duration="0:0:5"
                                             AutoReverse="True"
                                             RepeatBehavior="Forever" />

                                    <DoubleAnimation Storyboard.TargetName="xform"
                                             Storyboard.TargetProperty="TranslateY"
                                             From="0" To="600" Duration="0:0:7"
                                             AutoReverse="True"
                                             RepeatBehavior="Forever" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </controls:PanoramaItem.Triggers>
                </controls:PanoramaItem>
            </controls:Panorama>

效果如图

 

3.数据绑定

1)数据源类Datas.cs

    public static class Datas
    {
        public static List<string> GetDatas()
        {
            List<string> list = new List<string>();
            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();
        }
    }

效果如图

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/303846.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux 往文件写4k大小,[svc]为何linux ext4文件系统目录默认大小是4k?

linux ext4普通盘为什么目录大小是4k?Why does every directory have a size 4096 bytes (4 K)?To understand this, youd better have some basic knowledge of the following (file system):inode (contains file attributes, metadata of file, pointer structure)file (c…

3月份GitHub上最热门的开源项目

本篇文章为大家盘点了3月份GitHub最热门的开源项目&#xff0c;一起来看看你都知道哪些&#xff0c;或者有哪些你已经在使用的了。1Interview-Notebookhttps://github.com/CyC2018/Interview-Notebook Star 11975此项目是作者在准备 2018 年春招实习过程中的学习总结&#xff0…

自定义验证规则ValidationAttribute的使用

概述大家在做项目的时候&#xff0c;在实体类上添加一些特性,可以实现后端实体的数据校验。有时候&#xff0c;可能需要自定义验证属性。实现原理&#xff1a;利用反射获取实体的每一个属性&#xff0c;并通过属性获取属性上标注的特性&#xff0c;调用特性的Validate方法&…

【百度分享】基于内核模块的测试代码编写(二)

4. 用户空间和内核空间的交互 在解决了在内核空间置入可运行代码后&#xff0c;需要解决的是用户空间和内核空间的交互。具体来说&#xff0c;需要达到以下三个功能&#xff1a;用户空间的程序向内核空间下的程序控制&#xff0c;用户空间到内核空间的数据传递&#xff0c;内…

linux sed 空间模式,整理:SED的模式空间与缓冲区及n,N,d,D,p,P,h,H,g,G,x解析...

sed命令n&#xff0c;N&#xff0c;d&#xff0c;D&#xff0c;p&#xff0c;P&#xff0c;h&#xff0c;H&#xff0c;g&#xff0c;G&#xff0c;x解析1、sed执行模板sed ‘模式{命令1;命令2}’ 即逐行读入模式空间&#xff0c;执行命令&#xff0c;最后输出打印出来2、p打印…

你碰到过的最难调试的 Bug 是什么样的?

我们做开发的应该都会有深刻的体会&#xff0c;有时候会遇到一些莫名奇妙的BUG不知所措&#xff0c;解决BUG到近乎崩溃&#xff0c;更有甚者有人居然会在梦中解决掉BUG。下面我们看几个有意思的解决Bug的故事&#xff1a;知乎网友李幼萌&#xff1a;08年的时候&#xff0c;我所…

java面试题1

一、基础问答 1.下面哪些类可以被继承? java.lang.Thread (T)    java.lang.Number (T)    java.lang.Double (F)    java.lang.Math (F)    java.lang.Void (F)    java.lang.Class (F)    java.lang.ClassLoader (T) 2.抽象类和接口的区别 (1)接口可以被多…

云原生 | 阿里巴巴的Dapr实践与探索

【Dapr】| 原文/敖小剑&#xff0c;翻译/Edison本文原文来自Dapr Blog&#xff0c;作者阿里云高级技术专家敖小剑。本文是我根据自己的理解翻译了其中的一部分并加了一些参考文献中的内容&#xff0c;所以并非完整翻译&#xff0c;点击本文底部“阅读原文”即可阅读原版英文全文…

linux安装grpc占用空间大,grpc linux安装-Go语言中文社区

1. go protobuf 安装Protoc Buffer 安装包下载地址&#xff1a;https://github.com/protocolbuffers/protobuf/releases/download/v3.9.0/protoc-3.9.0-linux-x86_64.zip(使用wget命令下载)&#xff0c;最新版本可在此页面查看。下载完成后&#xff0c;解压。将解压出来的inclu…

《Objective-C基础教程》第二章 对C的扩展

.m代表message。编译工作由GCC(GNU Compiler Collection&#xff0c;GNU编译器集合)处理&#xff0c;可以理解C语言的全部3个变体。NS代码前缀表示来自Cocoa&#xff0c;苹果收购的NeXT Software公司开发的NextSTEP工具包。布尔类型BOOL具有YES和NO值&#xff0c;但使用8位存储…

阿里25k招.NET,要求WPF!

说到WPF、上位机&#xff0c;很多.NET开发者可能只是听过并不了解&#xff0c;然而随着工业4.0的火爆大势&#xff0c;当下.NET开发者又多了一个高薪选型&#xff0c;在各大招聘网站上都能找到5年经验25k左右的岗位&#xff0c;近日阿里对.NET的招聘&#xff0c;明确就要求的WP…

我们计划招收300名学员,免费攻读人工智能专业

给大家看一份最新的数据&#xff1a;&#xff08;薪资表&#xff09;2018年最新数据&#xff1a;python、大数据、人工智能从业者工资为什么人工智能行业的工资那么高&#xff1f;无论是科研院所&#xff0c;商业巨头还是初创企业&#xff0c;各行各业都在大力开发或者引进人工…

Linux查看设备 eth,lspci grep Eth,查看Linux下的各种硬件设备是否识别或存在之用

背景&#xff1a;Linux下的硬件有很多&#xff0c;如何看网卡是啥样的&#xff0c;声卡是啥样的有几个USB口及品牌。[rootemulMachine htdocs]# lspci |grep USB00:03.0 USB controller: Broadcom BCM5785 [HT1000] USB (rev 01)00:03.1 USB controller: Broadcom BCM5785 [HT1…

一日一技:ASP.NET Core 判断请求是否为Ajax请求

概述在写后台程序时&#xff0c;有时候需要知道客户端发送的是普通的请求&#xff0c;还是ajax 请求&#xff0c;最近在做项目的时候&#xff0c;有些地方需要判断当前的请求是不是ajax。特地找了下发现&#xff0c;jQuery 发出 ajax 请求时&#xff0c;会在请求头部添加一个名…

HttpHandler浅析

声明:本文为翻译文章,如有侵权,请告知,我将会在1个工作日内删除,谢谢. ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ 总是想着展翅飞翔,但是却不料一直受伤,但是那寻梦的心啊,永远向往着远方. ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★…

神经网络简史:BP算法后的又一突破—信念网络

随着训练多层神经网络的谜题被揭开&#xff0c;这个话题再一次变得空前热门&#xff0c;罗森布拉特的崇高雄心似乎也将得以实现。直到1989年另一个关键发现被公布&#xff0c;现在仍广为教科书及各大讲座引用。多层前馈神经网络是普适模拟器&#xff08; universal approximato…

Linux网络模块全局变量,()不是Linux系统的特色.

相关题目与解析UNIX是一个交互式的______操作系统&#xff0c;采用以全局变量为中心的模块结构。下列关于UNIX系统结构的描述中&#xff0c;正确的是______。A&#xff0e;UNIX系统是一个交互式的多用户、多任务分时操作按照变量的作用域可将变量划分为()A.公有、私有、系统B.全…

NET问答:Select 和 SelectMany 的区别

咨询区 Tarik&#xff1a;我已经 google 搜索了 Select 和 SelectMany 之间的区别&#xff0c;但我并没有找到合适的答案&#xff0c;我现在急切的需要知道在 Linq to SQL 时两者的区别而不是给我用Array展示...能否有人帮忙提供 Linq To SQL 的例子吗&#xff1f;回答区 Mike …

最好的FLV视频下载器 维棠 (支持优酷视频下载、土豆视频下载等)

维棠FLV视频下载能帮助你轻松下载国内外大多数FLV视频分享网站的视频内容;并且维棠FLV视频下载具有断点续传功能。 现在国内外出现了很多视频分享网站&#xff0c;每个用户都可以把自己的视频节目和其他人分享。这些网站有大量的在线视频资源&#xff0c;但是由于网络带宽的限…

linux ns3配置环境,Ubuntu下的NS3安装与入门

NS3的开发旨在为网络研究和教育提供开放&#xff0c;可扩展的网络仿真平台。简而言之&#xff0c;NS3提供了分组数据网络如何工作和执行的模型&#xff0c;并为用户提供了进行模拟实验的模拟引擎。使用ns-3的一些原因包括进行更难或不可能用真实系统执行的研究&#xff0c;在高…