2011-08-26 88 views
1

有没有一种简单的方法可以让Windows Phone 7的数字选取器看起来像一个timepicker控件?我想去有自定义范围0-99:0-59。 0-9,同时保持原生的Windows手机外观。 Google,Bing和msdn似乎对这个主题的信息非常含糊。Timepicker控件?

我发现了一篇文章,描述了我想要做的事here.我的问题是,文章是旧的,如果我键入工具包:在我的XAML代码中,没有任何建议出现了循环选择器。如果我进入我的工具箱,请右键单击,选择项目。没有用于循环选择器或无限列表选择器的控件。

source code也不起作用。

我对这里要做的事情感到不知所措。

我正在使用Visual Studio 2010/c#4.0。

+0

http://stackoverflow.com/questions/7210480/custom-number-picker的杜佩 –

回答

4

最简单的方法是使用的NuGet近期八月WP7 Silverlight Toolkit释放的引用添加到您的项目,然后将下面的命名空间引用添加到您的XAML的顶部

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

然后,您应该能够使用如下代码:

<toolkitPrimitives:LoopingSelector ... /> 
1

确保您使用的是正确的命名空间。 LoopingSelector位于Microsoft.Phone.Controls.Primitives命名空间中。所以,你的的xmlns应该是这样的:

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"