Daniel Gruszczyk
Daniel Gruszczyk

Reputation: 5622

WP8 Control for picking a number

I need to allow a user to select a number between 5 and 30 in my Windows Phone app, and I find it overall difficult to do.
I am using pivot control so I shouldn't use slider according to MS guidelines.
I have downloaded WPToolkit and they have a neat DatePicker and TimePicker controls, and I think something similar would be perfect to pick a number (just the same way you pick time when setting up an alarm).
I was considering simple textbox, but I think it would be much nicer to just pick from a list of numbers instead of typing in...
Any ideas how to implement it? Or have anyone done that alrady? I think I could put like a textbox with focus or click event that would redirect to another page that has LongListSelector and once an item has been selected I would redirect back to the original page and populate the textbox with the selected number... Is that doable?

Upvotes: 2

Views: 3401

Answers (2)

Pavel Saniuk
Pavel Saniuk

Reputation: 788

You need to use LoopingSelector from Windows Phone Toolkit. An example how to customize it is here http://www.maxpaulousky.com/blog/archive/2011/01/31/windows-phone-looping-selector-for-digits.aspx.

Upvotes: 2

keyboardP
keyboardP

Reputation: 69372

You can download the Toolkit source code and modify the DatePicker/TimePicker control to be more generic.

If you don't want to do that, you could just use the ListPicker control instead which is also included in the toolkit. Simply pass a list of numbers between 5 and 30 and the user can pick from the list.

Upvotes: 2

Related Questions