Maku
Maku

Reputation: 389

How to launch DatePickerPage from ApplicationBarIconButton?

I've tried to launch DatePickerPage after ApplicationBarIconButton is tapped.

I had hope that it would be easy as follows:

    DatePickerPage dpp = new DatePickerPage();

    dpp.Show();

    ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).Text = dpp.Value.ToString();

...but it wouldn't.

Could you give me some suggestions, please?

Upvotes: 2

Views: 1068

Answers (2)

nickohrn
nickohrn

Reputation: 2248

Maku, I'm letting users activate a datepicker from the ApplicationBar by placing it in the page and setting Height/Width to zero and then focusing the DatePicker when the ApplicationBarIcon is pressed.

Upvotes: 0

Derek Lakin
Derek Lakin

Reputation: 16319

I don't think the DatePickerPage is really intended to be used directly. The key control here is the DatePicker, which itself handles showing the picker page. For detailed information about using the DatePicker control, check out this article on WindowsPhoneGeek.com.

Given that the label of appbar icon buttons is not visible by default, it seems a bit strange to update the label in this way. What are you trying to achieve?

Upvotes: 4

Related Questions