Modifying Controls

May 8, 2011 at 8:45 PM
Edited May 9, 2011 at 2:27 AM

I'm interested in taking the TimeSpanPicker and make a new control to use with integer data.  From what I can see, there are 8 files I will need to copy and modify:

  • TsDataSource.cs
  • TimeSpanWrapper.cs
  • TimeSpanPickerPage.xaml
  • TimeSpanPickerPage.xaml.cs
  • TimeSpanPickerBasePage.cs
  • TimeSpanPicker.cs
  • ITimeSpanPickerPage.cs
  • DateTimePickerBase.cs

Are there any hints/suggestions that you can give to assist me in this?  I know I'm going to make some mistakes, but I really want to learn this, rather than ask someone else to create a control.

May 9, 2011 at 5:57 AM

Why?  What does the int map to in a timespan?  The Ticks?

May 9, 2011 at 9:40 AM

Wow, totally misread this :-).  So you just want a counter spinner that acts like the date/time/timespan pickers?

May 9, 2011 at 5:26 PM

Yes, that's the idea... that would eliminate users making mistakes in my app by typing the wrong thing; and it would also give a consistent look-and-feel, as I'm using the TimeSpanPicker as well.

May 15, 2011 at 5:15 PM

I am having troubles modifying this into a counter spinner... so I guess I will ask you to include a NumberPicker in the the next release.

Thank you!

May 15, 2011 at 7:50 PM

why not just use an input prompt with an inputscope?

var input = new InputPrompt
                    Title = "TelephoneNum",
                    Message = "I'm a message about Telephone numbers!",
                    Background = _lime,
                    Foreground = _pumpkin,
                    Overlay = _cornFlowerBlue,
                    IsCancelVisible = true

input.Completed += input_Completed;
input.InputScope = new InputScope { Names = { new InputScopeName() { NameValue = InputScopeNameValue.TelephoneNumber } } };
May 23, 2011 at 1:02 PM

Sorry for the late reply... thanks for the suggestion!  It may not look as nice as the pickers, but for what I need, they work just as well.