Forum Xamarin.Forms

How to set Material DatePicker’s Height?

ErdoganErdogan Member ✭✭✭
edited April 2020 in Xamarin.Forms

I'm trying to use the Material design but DatePicker's height doesn't look fit with others. How can I set its height?

iOS

Android

    <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <!--Isim-->
                <Entry Grid.Row="0" Grid.Column="0" Visual="Material" Placeholder="Isim" />

                <!--Countries-->
                <Picker Grid.Row="0" Grid.Column="1" Visual="Material"
                        SelectedIndex="0" SelectedItem="Turkey" Title="This is Picker" ItemsSource="{Binding CountryNames}">
                </Picker>

                <!--Soyisim-->
                <Entry Grid.Row="1" Grid.Column="0" Visual="Material" Placeholder="Soyisim" />

                <!--date-->
                <DatePicker Grid.Row="1" Grid.Column="1" Visual="Material" />

                <!--button-->
                <StackLayout Grid.Row="2" Grid.ColumnSpan="2">
                    <Button Command="{Binding LoginCommand}" Text="Login" HeightRequest="50" Visual="Material"/>
                </StackLayout>
            </Grid>

Best Answer

Answers

  • jezhjezh Member, Xamarin Team Xamurai
    edited April 2020

    Hey friend, @Erdogan I couldn't reproduce this question after I tested your code with android and ios emulators.

    What device did you use to test ?

    In IOS

    In Android

  • ErdoganErdogan Member ✭✭✭

    Hey jezh, thanks for your reply.

    iOS : iPhone (8 or 11) iOS 13.4
    Android : (pixel or nexus)_2_pie_9 api 28

    Ps: There is no defined style in the XAML.

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @Erdogan said:
    Hey jezh, thanks for your reply.

    iOS : iPhone (8 or 11) iOS 13.4
    Android : (pixel or nexus)_2_pie_9 api 28

    Ps: There is no defined style in the XAML.

    Did you try setting VerticalOptions="FillAndExpand"?

  • ErdoganErdogan Member ✭✭✭
    > @ShantimohanElchuri said:
    > (Quote)
    > Did you try setting VerticalOptions="FillAndExpand"?

    Yes, of course. It’s not related with VerticalOptions.
  • jezhjezh Member, Xamarin Team Xamurai

    Sorry, @Erdogan I tesed on iOS emulator : iPhone (8 or 11) iOS 13.4. There was no such problem.

    You can try to update the Xamarin Forms to the latest version.

    If the problem still persists, could you please post a basic demo or the whole xaml code of your app?

  • ErdoganErdogan Member ✭✭✭

    It's already last stable version (4.5.0.617)

    There is no new update for XF.

  • jezhjezh Member, Xamarin Team Xamurai

    Then could you please post a basic demo or the whole xaml code of your app so that we can help you better?

  • ErdoganErdogan Member ✭✭✭

    Here is my test page's xaml;

    <?xml version="1.0" encoding="UTF-8"?>
    <ContentPage
        xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        x:Class="HTMobile.TEST.MyPage">
    
        <ContentPage.Content>
            <Grid>
                <!--Isim-->
                    <Entry Grid.Row="1" Visual="Material" Placeholder="Isim"
                           Grid.Column="0" />
    
                    <!--Countries-->
                    <Picker Grid.Row="1" Visual="Material"
                            SelectedIndex="0" SelectedItem="Turkey" Title="This is Picker" ItemsSource="{Binding CountryNames}"
                            Grid.Column="1"> 
                    </Picker>
    
                    <!--Soyisim-->
                    <Entry Grid.Row="2" Visual="Material" Placeholder="Soyisim" 
                           Grid.Column="0" />
    
                    <!--date-->
                    <DatePicker Grid.Column="1" Grid.Row="2" Visual="Material" />
    
                    <!--button-->
                    <StackLayout Grid.Row="3" Grid.ColumnSpan="2">
                        <Button Command="{Binding LoginCommand}" Text="Login" HeightRequest="50" Visual="Material"/>
                    </StackLayout>
            </Grid>
        </ContentPage.Content>
    </ContentPage>
    

    I've deleted the last version and installed the previous one but again no luck :/

  • ErdoganErdogan Member ✭✭✭

    @jezh, this is Github link

  • ErdoganErdogan Member ✭✭✭
    Okay, I subscribed. Thanks.
  • jezhjezh Member, Xamarin Team Xamurai

    Hey friend, could you please mark this thread to finish this topic? Thanks. :)

    Best Regards!

    Jezh

  • ErdoganErdogan Member ✭✭✭
    > @jezh said:
    > Hey friend, @Erdogan I couldn't reproduce this question after I tested your code with android and ios emulators.
    >
    > What device did you use to test ?
    >
    > In IOS
    >
    > (Image)
    >
    >
    > In Android

    Which version is yours? I can use it for now.
Sign In or Register to comment.