代码之家  ›  专栏  ›  技术社区  ›  Mahajan344

Stacklayout内的Xamarin表单网格问题

  •  0
  • Mahajan344  · 技术社区  · 8 年前

    我正在开发Xamarin表单,需要在其中显示网格。我正在使用 StackLayout 创建表单。在我添加网格之前,一切都正常 堆栈布局 ., 然后我得到了一个错误 Timeout exceeded getting exception details

    这是我的代码:

    <ContentPage.Content>
            <StackLayout VerticalOptions="StartAndExpand" BackgroundColor="White">
                <StackLayout Padding="20,40,20,0" HorizontalOptions="CenterAndExpand">
                    <Image Source="logo.png" Aspect="AspectFit" HorizontalOptions="Center"></Image>
                </StackLayout>
    
    
                <StackLayout Padding="15,20,15,0" VerticalOptions="Center">
    
                    <local:ImageEntry TextColor="#98a4b4" 
                                      PlaceholderColor="#98a4b4" FontFamily="ProximaNova"
                                      Image="LoginEmailIcon" 
                                      Placeholder="Email" 
                                      HorizontalOptions="FillAndExpand"
                                      ImageWidth="25"
                                      ImageHeight="20"
                                      LineColor="#98a4b4"/>
    
    
                    <local:ImageEntry TextColor="#98a4b4" 
                                      PlaceholderColor="#98a4b4" FontFamily="ProximaNova"
                                      Image="LoginPasswordIcon" 
                                      Placeholder="Password" 
                                      HorizontalOptions="FillAndExpand"
                                      ImageWidth="23"
                                      ImageHeight="25"
                                      LineColor="#98a4b4" IsPassword="True"/>
                    <Label  Text=" Forgot your password?"
                            HorizontalOptions="StartAndExpand"  FontFamily="ProximaNova"
                            TextColor="#bcbcbc"/>
    
                    <StackLayout Orientation="Horizontal">
                        <Button x:Name="ButtonSignin" BackgroundColor="#29abdf" TextColor="White" HorizontalOptions="FillAndExpand" FontFamily="ProximaNova" Text="Sign in" FontAttributes="Bold"/>
                    </StackLayout>
    
                    <StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="25px" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                            </Grid.ColumnDefinitions>
                            <Image Source="loginsideicon.png" Grid.Row="0" Grid.Column="0"></Image>
                            <Label Text="OR" Grid.Row="0" Grid.Column="1" FontFamily="ProximaNova" TextColor="#bcbcbc"></Label>
                            <Image Source="loginsideicon.png" Grid.Row="0" Grid.Column="2"></Image>
                        </Grid>
                        </StackLayout>
    
                </StackLayout>
            </StackLayout>
        </ContentPage.Content>
    

    现在,当我运行此代码时,出现异常:

    Unhandled Exception:
    
    System.FormatException: <Timeout exceeded getting exception details> occurred
    

    但当我评论网格代码时,一切都正常

    1 回复  |  直到 8 年前
        1
  •  3
  •   LeRoy    8 年前

    我注意到您的xaml存在一些问题:

    -使用大写字母表示 汽车

    <ColumnDefinition Width="Auto" />
    

    -我们不使用25 二甲苯 使用xaml

    <RowDefinition Height="25" />

    推荐文章