如何将循环选择器添加到Windows Phone 8.1应用程序?

时间:2014-11-27 15:14:58

标签: c# windows-phone-8.1 loopingselector

我正在尝试将下面图片中的数字列表添加到Windows Phone 8.1应用中的某个页面,但我无法在工具箱中找到循环选择器控件来实现此目的:

http://www.geekchamp.com/articles/wp7-loopingselector-in-depth--part1-visual-structure-and-api

我试图通过右键单击工具箱并添加一个控件来添加缺少的控件,但它不存在。

这就是我使用coding4fun时间跨度选择器获取时间的方法:

<c4fToolkit:TimeSpanPicker Header="Rest Interval" x:Name="restTimeSpanPkr" Max="12:59:59" Step="1:1:1" Margin="-12,323,12,-278" Grid.RowSpan="2"/>

有没有人知道如何添加丢失的工具,或者在Windows Phone 8.1中是否有不同的方式来实现这一目标?

toolbox missing looping selector

list of numbers

1 个答案:

答案 0 :(得分:3)

使用NuGet安装Windows Phone Toolkit或在其网站上下载:The Windows Phone Toolkit

如果工具包已成功安装,则参考文件夹应如下所示

enter image description here

然后将Primitive命名空间添加到XAML文件中。

<phone:PhoneApplicationPage
    xmlns:toolkit_primitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit">

然后你可以使用循环选择器。

<toolkit_primitives:LoopingSelector>
    <primitives:LoopingSelector.ItemTemplate>
        <DataTemplate>
             <!-- design your own square box+text -->
        </DataTemplate>
    </primitives:LoopingSelector.ItemTemplate>      
</toolkit_primitives:LoopingSelector>

Intellisense也应该把它拿起来

enter image description here