How to add a looping selector to a Windows Phone 8.1 app?

情到浓时终转凉″ 提交于 2019-12-07 18:30:03

问题


I'm trying to a add a list of numbers like in the picture below to a page in a Windows Phone 8.1 app, but I can't find the looping selector control in the toolbox to acheive this:

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

I've tried to add the missing control by right clicking on the toolbox and adding a control but its not there.

This is how I've achieved picking a time using the coding4fun time span picker:

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

Does anyone have any idea how to add the missing tool or is there a different way of achevingthis in Windows phone 8.1?


回答1:


Install the Windows Phone Toolkit using NuGet or download it on their website: The Windows Phone Toolkit

If the toolkit is successfully installed the reference folder should look like this

Then add the Primitive namespace to the XAML file.

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

Then you can use the looping selector.

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

Intellisense should pick it up as well



来源:https://stackoverflow.com/questions/27173851/how-to-add-a-looping-selector-to-a-windows-phone-8-1-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!