-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixes 7992 Changes UWP DatePicker to show the picker flyout on DatePickerFocus() #8056
Conversation
Update from XF
Fork Update
Sync to source
Update from base
Update from XF Master
Update from XF 4/30/19
Update from XF master
Oct 4th Update
Oct 14th Update
var stackLayout = new StackLayout(); | ||
Content = stackLayout; | ||
|
||
stackLayout.Children.Add(new Label { Text = "Label to keep picker from getting initial focus" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the label is there, why not give it some information on what this test case does exactly. What is the person coming here expecting to see, to do and when is the test succeeded? Why try to add a label like that for most of our "Issue" pages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point, I just got the issue page to a workable stage to review the method to see if it would be acceptable, so I'll do some more polishing. I'll also go update the issue page for #7986 with instructions.
// Show a picker fly out on focus to match iOS and Android behavior | ||
var flyout = new DatePickerFlyout { Placement = FlyoutPlacementMode.Bottom, Date = Control.Date }; | ||
flyout.DatePicked += (p, e) => Control.Date = p.Date; | ||
flyout.ShowAt(Control); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this behave when the picker is set to not visible? See for instance #5159
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick test on when it's not visible, it opens but I'm not sure the positioning is great. Seems like it will open at the root coordinate of the current screen.
What I'm thinking to do is if the control isn't visible use the Full placement of the flyout, which will have the picker popup fill the current screen.
Thoughts?
I'll also update the issue page to include both a visible and not visible control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected and like other platforms.
* 'master' of github.com:xamarin/Xamarin.Forms: (330 commits) [Android] Fix color filter usage on API29 (xamarin#9180) Add null check to GetIconColor (xamarin#9172) Apply cecil fixes to make packages 2017 compatible (xamarin#9145) [UWP] Attempt to resolve entry on UWP not correctly calculating the correct height when in a scroll view (xamarin#8214) Fixes 7992 Changes UWP DatePicker to show the picker flyout on DatePickerFocus() (xamarin#8056) Update bug_report.md (xamarin#8688) [android/ios] improve perf when not using Application.Properties (xamarin#8887) The great Androidx IF Def'ing of 2019 (xamarin#8898) Added IconColor property for managing navigation icon color (xamarin#5185) Add UWP display prompt (xamarin#8720) fix bad merge Fix 8743 - now using specific style in SearchBar [UWP] (xamarin#8773) Added the SwipeView tag to the Core Gallery samples (xamarin#8819) [Tizen] Shell: FlyoutBackgroundImage, FlyoutBackgroundImageAspect (xamarin#8905) [Core] remove array covariant cast for UWP (xamarin#9135) [android] remove Anticipator.cs for now (xamarin#8858) Update the CarouselView Position setting the CurrentItem (xamarin#7946) fixes xamarin#7924 send remove events (xamarin#9124) [platform] improve perf of PropertyChangedEventArgsExtensions (xamarin#9084) Fix SeachBarRenderer CreateNativeControl issue (xamarin#8946) ... # Conflicts: # Xamarin.Forms.Core/FontImageSource.cs
Description of Change
Modifies the UWP DatePickerRenderer to open a DatePickerFlyout when DatePicker.Focus() is called by overriding OnElementFocusChangeRequested. This is to match the behavior on iOS and Android.
After much research I have not been able to find a way to get the default DatePicker clicked behavior to open. So to replicate that, I use a DatePickerFlyout that is opened in OnElementFocusChangeRequested. This doesn't produce the same visual effect, but provides the same functionality.
Marking this as a draft PR right now so that this approach can be validated and approved. If approved, this same change could be made to TimePicker and maybe Picker.
Issues Resolved
Fixes #7992
API Changes
None
Platforms Affected
Behavioral/Visual Changes
Calling DatePicker.Focus() now opens a Flyout in UWP to match iOS and Android
Before/After Screenshots
UWP DatePicker "Clicked" flyout

UWP DatePickerFlyout when opened by a call to XF DatePicker.Focus()

Testing Procedure
Issue page in Control Gallery
PR Checklist