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();
        }
    }

效果如图

 

Windows Phone 7Silverlight控件之--Panorama相关推荐

  1. Windows Phone UI控件

    培训第一章XAML介绍属性设置设置方式:1: 特性设置2: 使用属性元素属性继承XAML中的颜色和画刷Content属性资源定义和访问共享机制 画刷 外观 文字等Style使用与继承Style是属性集 ...

  2. 背水一战 Windows 10 (65) - 控件(WebView): 对 WebView 中的内容截图, 通过 Share Contract 分享 WebView 中的被选中的内容...

    原文:背水一战 Windows 10 (65) - 控件(WebView): 对 WebView 中的内容截图, 通过 Share Contract 分享 WebView 中的被选中的内容 [源码下载 ...

  3. 背水一战 Windows 10 (40) - 控件(导航类): AppBar, CommandBar

    原文:背水一战 Windows 10 (40) - 控件(导航类): AppBar, CommandBar [源码下载] 背水一战 Windows 10 (40) - 控件(导航类): AppBar, ...

  4. 背水一战 Windows 10 (47) - 控件(ScrollViewer 特性): Chaining, Rail, Inertia, Snap, Zoom

    原文:背水一战 Windows 10 (47) - 控件(ScrollViewer 特性): Chaining, Rail, Inertia, Snap, Zoom [源码下载] 背水一战 Windo ...

  5. 背水一战 Windows 10 (61) - 控件(媒体类): InkCanvas 涂鸦编辑

    背水一战 Windows 10 (61) - 控件(媒体类): InkCanvas 涂鸦编辑 原文:背水一战 Windows 10 (61) - 控件(媒体类): InkCanvas 涂鸦编辑 [源码 ...

  6. 背水一战 Windows 10 (36) - 控件(弹出类): ToolTip, Popup, PopupMenu

    原文:背水一战 Windows 10 (36) - 控件(弹出类): ToolTip, Popup, PopupMenu [源码下载] 背水一战 Windows 10 (36) - 控件(弹出类): ...

  7. C# WinForm 添加Windows Media Player 控件调试出现未能加载文件或程序集Interop.WMPLib,该怎么解决...

    C# WinForm 添加Windows Media Player 控件调试出现未能加载文件或程序集Interop.WMPLib 如标题,在窗体中添加Windows Media Player 控件,当 ...

  8. 背水一战 Windows 10 (30) - 控件(文本类): AutoSuggestBox

    背水一战 Windows 10 (30) - 控件(文本类): AutoSuggestBox 原文:背水一战 Windows 10 (30) - 控件(文本类): AutoSuggestBox [源码 ...

  9. 背水一战 Windows 10 (70) - 控件(控件基类): UIElement - Transform3D(3D变换), Projection(3D投影)...

    原文:背水一战 Windows 10 (70) - 控件(控件基类): UIElement - Transform3D(3D变换), Projection(3D投影) [源码下载] 背水一战 Wind ...

最新文章

  1. [转]Android UI 自动化测试
  2. 瞧瞧 Fog Creek 软件公司办公环境
  3. mybatis枚举自动转换(通用转换处理器实现)
  4. 使用2to3.py 转换 python2.x 代码 到python3
  5. LeetCode 765. 情侣牵手(贪心)
  6. 《代码敲不队》第八次团队作业:Alpha冲刺 第五天
  7. 51nod 1428 活动安排问题 (贪心+优先队列)
  8. 利用ENVI深度学习进行遥感变化监测
  9. seo和sem的区别是什么?网站seo具体怎么做?
  10. 企业安全建设-蜜标(honeytokens)
  11. 【每月总结】2021年6月
  12. Python-Data-Science-Toolbox-Part-1
  13. 人工智能方面会议评分与简介(转)
  14. notability废纸篓在哪里_Notability 4.4中文版
  15. 我是马云:新入职员工勿批判公司
  16. 2021年起重机械指挥考试总结及起重机械指挥考试技巧
  17. 突发!ST再发涨价函!6月1日起全线涨价!
  18. PAT | 1080 MOOC期终成绩 (25分)【附柳神代码】
  19. [数学理论]最大熵模型
  20. HTML5交互性是什么意思,HTML5的结构和语义(5):交互

热门文章

  1. 《Adobe After Effects CS6完全剖析》——动画:最重要的是关系
  2. JavaScript中的一些特殊用法(一)
  3. IOS Table中Cell的重用reuse机制分析
  4. 在C#2.0中使用Nullable可空类型
  5. 关于Elemet-ui组件Cascader中proper的配置问题
  6. Spring实战Day2
  7. thinkpaidE480office安装文件夹
  8. 【转载】利用scipy.misc等库对jpg以及png等图像数据预处理(用于深度学习喂数据)...
  9. FPGA浮点数定点化
  10. WindowsPhone8可缩放图片控件的实现