SfDatePicker always open

Hi, I am using the SfDatePicker in my Xamarin.Forms app with Shell.

Unfortunately, the date picker always appears open without any click on the control. Clicking outside the SfDatePicker does not cause the date control to close. I am not clear if this is the expected behavior or how to get the SfDatePicker to close. 

Thank you,
Judi Smith

The XAML follows:

<textInputLayout:SfTextInputLayout
                        ContainerType="Filled"
                        Hint="Date"
                        HelperText="Select birth date">
                        <syncfusion1:SfDatePicker 
                            x:Name="birthdatePicker" 
                            HeaderText="Select student's birthdate"
                            ShowFooter="True"
                            MinimumDate="1930, 1, 1" 
                            MaximumDate="{x:Static system:DateTime.Today}" 
                            VerticalOptions="Center" 
                            HorizontalOptions="Center" 
                            DateSelected="DatePicker_DateSelected"/>
                    </textInputLayout:SfTextInputLayout>



3 Replies 1 reply marked as answer

SP Sakthivel Palaniyappan Syncfusion Team December 30, 2020 09:43 AM UTC

Hi Judi,

Greetings from Syncfusion,

We have analyzed your query. Currently we don’t have support for Picker inside TextInputLayout. We have already logged feature request for Picker Inside TextInputLayout and it can be tracked through our feedback portal below

Feedback link:
https://www.syncfusion.com/feedback/10005/support-for-sfpicker-in-sftextinputlayout

Please upvote this feature to make this our priority. While this feature itself is important we will prioritize the features every release, based on the user demands. So, this feature will be available in any of our upcoming releases.

If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.

However, you can achieve this requirement by adding Xamarin.Forms Entry inside the TextInputLayout and  by calling picker from entry Focused event as like below code snippet.

XAML:
 
<StackLayout> 
    <textInputLayout:SfTextInputLayout 
                        ContainerType="Filled" 
                        Hint="Date" 
                        HelperText="Select birth date"> 
        <Entry Focused="entry_Focused" x:Name="entry"/> 
    </textInputLayout:SfTextInputLayout> 
    <syncfusion1:SfDatePicker PickerMode="Dialog" 
                            x:Name="birthdatePicker" PickerWidth="250" PickerHeight="300" 
                            HeaderText="Select student's birthdate" 
                            ShowFooter="True" DateSelected="birthdatePicker_DateSelected" 
                            MinimumDate="1930, 1, 1" 
                            MaximumDate="2020,12,30" 
                            VerticalOptions="Center" 
                            HorizontalOptions="Center" /> 
</StackLayout> 
 

C#:

 
    void entry_Focused(System.Object sender, Xamarin.Forms.FocusEventArgs e) 
    {​​​​​​​ 
            birthdatePicker.IsOpen = true; 
    }​​​​​​​ 

We have created sample based on your requirement , please find the sample from below.

Sample link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/DatePickerSample964203854.zip

Please let us know if you have any other queries.

Regards,
Sakthivel P.
 


Marked as answer

JS Judi Smith December 30, 2020 02:46 PM UTC

Thank you for the solution.

For your reference, the documentation on SfTextInputLayout states explicitly that SfDatePicker is supported. https://help.syncfusion.com/xamarin/text-input-layout/supported-input-views.

However, this solution works just fine for what I need.


SP Sakthivel Palaniyappan Syncfusion Team December 31, 2020 09:57 AM UTC

Hi Judi,

Thanks for the update.

We are glad to know that given solution works at your end and we would like to know that SfTextInputLayout supports Xamarin.Forms Picker controls, in our document we have used Xamarin.Forms Picker as InputView. For SfPicker control we will implement the support and include any of our upcoming main releases.

Please let us know if you have any other queries.

Regards,
Sakthivel P.
 


Loader.
Up arrow icon