locked
Calendar Date Picker In Xamarin Forms UWP RRS feed

  • Question

  • User362979 posted

    How to create a calendar type date picker in Xamarin forms UWP app.

    So far I have tried this:

        <Image Grid.Row="3" Grid.Column="1" Source="Images/datePicker.png" WidthRequest="20" HeightRequest="20" Margin="-40,0,40,0" HorizontalOptions="End">
                                <Image.GestureRecognizers>
                                    <TapGestureRecognizer Command="{Binding OnSelectDOBCommand}"/>
                                </Image.GestureRecognizers>
                            </Image>
    
    public void OnSelectDOB(object obj)
        {         
            dateOfBuildDatePicker = UserDialogs.Instance.DatePrompt(new DatePromptConfig { MaximumDate = DateTime.Today, OnAction = (result) => SetDateOfBirth(result), IsCancellable = true });
        }
    

    But this displays the date picker control on top left corner of the screen. Is there a way to customize it so that it should display the date picker right next to the field where I click or is there any other control which can help me achieve this functionality.(Below image is the behavior that I am expecting)

    Monday, May 20, 2019 10:19 AM

All replies

  • User180523 posted

    Is there a way to customize it so that it should display the date picker right next to the field where I click I don't use Acer popups, I use rg.plugins.popups. But I bet the concept should be nearly the same.

    Get the Bounds of the caller - the Button the user clicked. Then set the location of your calendar popup the Bounds.Left and Bounds.Bottom of the caller. That will have the popup start just below the caller as shown in your screen shot.

    FYI: If you use markdown syntaxin your posts the the site won't try to render your XAML https://redpillxamarin.com/2016/12/13/faq-frequently-asked-questions/

    Monday, May 20, 2019 11:30 AM