I'm bringing up the DatePicker by clicking a regular Button and doing "myPicker.Focus()". So far so good.
Now, to reproduce this issue, you need a tabbed page with THREE tabs!
On the first tab, add the datepicker and a button. Clicking on the button should focus the datepicker.
The second and third tab-pages can be any kind of pages.
Start the app. Now, klicking the button will still work fine! The datepicker will show.
First navigating to the SECOND tab, then back to the first tab and clicking the button will ALSO work as expected.
However, if you navigate to the THIRD tab and then back to the first tab and click the button.... BOOM. You have a NullReferenceException.
Could you put together a reproduction sample? It'd be appreciated.
Well, I don't have the time right now, but just follow the instructions in my first message and you will have the repro.
- Start App, select third tab, then first tab.
- Click the button, boom!
It could work based on the complexity of your view containing the date picker. The solution atm would be to crate your content in the Onappearing method (tab1 calls appearing when swiping to tab2 from tab3). appearing events are a bit broken in FormsAppcompatactivity but this works as a workaround for the repro. Create a new ContentPage class and set it to the first tab and override its onappearing.
I ran the repro in 2.3.3.163-pre3 but wasn't able to reproduce the issue.
Yes, it appears to have been fixed somewhere between 2.3.0.46-pre3 and 2.3.3.163-pre3. Thanks for the heads up!