Visual State Manager和Entry &&触发键盘Xamarin表单的问题

时间:2018-11-27 10:38:43

标签: xamarin.forms visualstatemanager

在第一部分中,我使用了网格,我不得不在输入文件时两次敲击键盘,而在第二部分中,没有网格,只是从第一次开始,我不明白为什么

  <ContentPage.Content>
            <Grid  VerticalOptions="FillAndExpand">
                <Grid.ColumnSpacing>
                    <OnIdiom x:TypeArguments="x:Double"
                 Phone="0"
                 Tablet="40"/>
                </Grid.ColumnSpacing>
                <Grid.RowSpacing>
                    <OnIdiom x:TypeArguments="x:Double"
                 Phone="20"
                 Tablet="20"/>
                </Grid.RowSpacing>
                <Grid.Padding>
                    <OnIdiom x:TypeArguments="Thickness"
                 Phone="10, 30, 10, 30"
                 Tablet="20, 20, 20, 0"/>
                </Grid.Padding>

                <Grid.RowDefinitions>
                    <RowDefinition Height="3*"/>
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="2*" />


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

                </Grid.ColumnDefinitions>


                <StackLayout Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2">

                <Entry Placeholder="Insert your code here"  
                   HorizontalOptions="Center"
                       VerticalOptions="Center"            
                    x:Name="cltCode">


                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal">
                                <VisualState.Setters>

                                </VisualState.Setters>
                            </VisualState>

                            <VisualState x:Name="Focused">
                                <VisualState.Setters>
                                    <Setter Property="FontSize" Value="30" />

                                </VisualState.Setters>
                            </VisualState>

                            <VisualState x:Name="Disabled">
                                <VisualState.Setters>

                                </VisualState.Setters>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>



                </Entry>

                </StackLayout>


            </Grid>
        </ContentPage.Content>

https://drive.google.com/open?id=1-1AsOckjkXrno1M7yhiq1cVdyRC0FoBU

    <ContentPage.Content>
            <Entry Placeholder="Insert your code here"  
               HorizontalOptions="Center"
                   VerticalOptions="Center"            
                x:Name="cltCode">


                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal">
                            <VisualState.Setters>

                            </VisualState.Setters>
                        </VisualState>

                        <VisualState x:Name="Focused">
                            <VisualState.Setters>
                                <Setter Property="FontSize" Value="30" />

                            </VisualState.Setters>
                        </VisualState>

                        <VisualState x:Name="Disabled">
                            <VisualState.Setters>

                            </VisualState.Setters>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
            </Entry>      
    </ContentPage.Content>

https://drive.google.com/open?id=1-3KC3CmeisaYuthFTnPTMJ62hDE4zeeI

1 个答案:

答案 0 :(得分:0)

这是xamarin形式的问题,这是问题链接:重点不在触发键盘

https://github.com/xamarin/Xamarin.Forms/issues/4573