Silverlight for Windows Phone Toolkit升级说明
最后更新于:2022-04-01 11:30:34
PDC 10后,不少开发人员将目光转移到了移动应用开发平台,Windows Phone 7是移动应用平台之一,也是微软推出的最新移动平台操作系统。Silverlight作为Windows Phone 7应用核心开发技术,再一次展示其强大的功能和优势。为了方便Windows Phone 7开发人员创建应用,微软Silverlight团队特别推出Silverlight for Windows Phone Toolkit开发控件集合,目前已经包括了10余中独立控件可用于Windows Phone开发平台。11月3日,Silverlight for Windows Phone Toolkit开发控件包升级,推出四个新的Windows Phone控件:
- AutoCompleteBox
- ListPicker
- LongListSelector
- Page Transitions
**AutoCompleteBox**,这个控件大家并不陌生,在Google,百度搜索引擎平台经常用到,可自动搜索相关字符,对输入文本进行关联。
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d93a4600.jpg)
~~~
<toolkit:AutoCompleteBox ItemsSource="{StaticResource words}"/>
~~~
**ListPicker**,该控件类似于ComboBox控件,用户选择时,弹出一个选项列表,用户可以从中选择其需要的选项。
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d93babef.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d93d0785.jpg)
~~~
<toolkit:ListPicker Header="background">
<sys:String>选项1</sys:String>
<sys:String>选项2</sys:String>
<sys:String>选项3</sys:String>
</toolkit:ListPicker>
~~~
**LongListSelector**, 该控件是对于ListBox控件的一个扩展,在原有ListBox基础上,增加了一些特殊功能,例如平行列表,分组列表等。
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d93e2bb0.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d9409cea.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d9421170.jpg)
~~~
<toolkit:LongListSelector
ItemsSource="{StaticResource movies}"
ListHeaderTemplate="{StaticResource movieListHeader}"
GroupHeaderTemplate="{StaticResource movieGroupHeader}"
GroupFooterTemplate="{StaticResource movieGroupFooter}"
GroupItemTemplate="{StaticResource groupItemHeader}"
ItemTemplate="{StaticResource movieItemTemplate}">
</toolkit:LongListSelector>
~~~
**Page Transitions**,可以提供页面动画切换效果。
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-04-27_57205d943ad36.jpg)
RootFrame = new TransitionFrame();
~~~
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
~~~
除了以上四个新控件以外,目前Silverlight for Windows Phone Toolkit中还包括以下几个控件:
- GestureService/GestureListener
- ContextMenu
- DatePicker
- TimePicker
- ToggleSwitch
- WrapPanel
Silverlight for Windows Phone Toolkit是开源项目,大家可以在项目官网上下载项目源代码和例程代码参考学习。