WP7 MonthYear Picker

For credit card expiry dates I needed to mod the Microsoft.Phone.Controls.DatePicker to only ask for Month and Year.
This was surprisingly convoluted but thanks for reflector, achievable. The xaml for the existing date picker is a resource in the dll but you do have to do a fair amount of work to keep it happy that it doesn’t have a day part anymore.
Seems to work and we’re on track for submitting the app tomorrow! 🙂

4 thoughts on “WP7 MonthYear Picker

  1. Indeed I am. You can override the xaml page used for the picker by setting PickerPageUri, e.g.

    <toolkit:DatePicker PickerPageUri="/Views/MonthYearPicker.xaml"
    Value="{Binding ExpiryDateSelectorValue, Mode=TwoWay}"
    Margin="-10,0,0,0" />

    Then provide a MonthYearPicker.xaml page which has some code to override the different datasources (such as YearDataSource etc.). You can use reflector to extract the existing DateTimePicker.xaml.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s