As far as I understand understand the DatePicker control in the WP7 Controls Toolkit, it opens a DatePickerPage to let you select the date for the control.
I need such a page directly in my app, without the picker control first. Ideally my page would have an additional "today" button, that resets the weels to开发者_开发问答 the current date.
How can I build this? Should I derive from DatePickerPage or DateTimePickerPageBase? How can I call the page (I tried to navigate to the DatePickerPage with NavigationService.Navigate, but I got an NullReferenceException) and get/set the date?
Ok, now I got it. I can manually navigate to the DatePickerPage
, but I have to assign the date to the value of the page in the Navigated
event:
void dialogFrame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
// ...
IDateTimePickerPage page = e.Content as IDateTimePickerPage;
if (page != null)
{
page.Value = myDate;
}
}
精彩评论