Is there a possible way of changing the Android DatePicker in Forms?

coosmiyncoosmiyn Member ✭✭

Hello. I am using Xamarin Forms and I am trying to do something with a DatePicker but on android the control for it is not that great and also not too intuitive for some. Is there a way of using the DatePicker Dialog on Forms? Or just a different DatePicker.

Answers

  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭
    edited August 14

    You can change (or create) any control you want, and on any platform. You just need to write a Custom Renderer. Found this control for Android, just write a Custom Renderer for it.

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited August 15

    Try the Syncfusion.Xamarin.SfPicker plugin. It provides dfferent styles for picker.

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:syncfusion="clr-namespace:Syncfusion.SfPicker.XForms;assembly=Syncfusion.SfPicker.XForms"
                 xmlns:local="clr-namespace:App18"
                 x:Class="App18.Page11">
    
        <ContentPage.BindingContext>
            <local:DatePickerViewModel />
        </ContentPage.BindingContext>
    
        <ContentPage.Content>
            <Grid>
                <Button
                    Clicked="Button_Clicked"
                    HeightRequest="50"
                    HorizontalOptions="Center"
                    Text="Show Picker"
                    VerticalOptions="Center"
                    WidthRequest="200" />
                <local:CustomDatePicker
                    x:Name="date"
                    ColumnHeaderHeight="40"
                    HorizontalOptions="Center"
                    PickerHeight="400"
                    PickerMode="Dialog"
                    PickerWidth="300"
                    SelectedItem="{Binding StartDate}"
                    VerticalOptions="Center" />
            </Grid>
        </ContentPage.Content>
    </ContentPage>
    

Sign In or Register to comment.