Bug 45533 - [Xamarin.Forms][UWP]DatePicker doesn't show up by `.Focus();`
Summary: [Xamarin.Forms][UWP]DatePicker doesn't show up by `.Focus();`
Status: RESOLVED DUPLICATE of bug 37376
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-10-17 03:08 UTC by Maxime GUITTET
Modified: 2017-03-31 18:32 UTC (History)
3 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 37376

Description Maxime GUITTET 2016-10-17 03:08:16 UTC
Hi,

The bug is really simple, when I'm trying to open my `DatePicker` control, the calendar doesn't show up on the UWP Debug/Release mod by calling the DatePicker.Focus(); method. However, when I'm trying the same thing, but on Android, then it works..

Explaination:

        <DatePicker x:Name="DatePickerControl" IsVisible="False"
                    Format="dd-MM-yyyy"
                    MinimumDate="{Binding CurrentDate}" Date="{Binding CurrentDate}"
                    AbsoluteLayout.LayoutBounds="0.5, 0.5, 1, 1"
                    AbsoluteLayout.LayoutFlags="All"/>

I have this DatePicker declared in the XAML part. I put it as Invisible. Then, to open it, I'm using a button and from this button, I just call DatePickerControl.Focus(); - Example below:

        private void OnDateClicked(object sender, EventArgs ea)
        {
            Debug.WriteLine("PLOPPP");
            Device.BeginInvokeOnMainThread(() => {
                DatePickerControl.Focus();
            });
        }

or

        private void OnDateClicked(object sender, EventArgs ea)
        {
            Debug.WriteLine("PLOPPP");
            //Device.BeginInvokeOnMainThread(() => {
                DatePickerControl.Focus();
            //});
        }

**Nothing happens**

However, I tried to debug on Android and.. It works.

I tried this explaination on UWP (I tried on my computer (x86, Local Machine) and on my Microsoft Phone Lumia WIN 10 (ARM, Device)) but, Nothing. With Android (ARM, Google Nexus), it works.

I can't test it on iOS but I got this answer about how to open a Calendar from a button by reading a post where the guy tried to do that for iOS.. So I think it works for iOS, it works for android for sure, but not for UWP..

Why?

Maxime GUITTET
Comment 1 Paul DiPietro [MSFT] 2016-10-18 17:20:33 UTC
This is directly related to 37376.

*** This bug has been marked as a duplicate of bug 37376 ***
Comment 2 Dan Meier 2017-03-31 18:32:20 UTC
Exactly the same problem exists with the Picker control. The Picker.Focus() method does nothing in UWP.  Works as expected in Android and iOS.