【问题标题】:Create table list in Xamarin forms在 Xamarin 表单中创建表列表
【发布时间】:2019-11-13 20:23:18
【问题描述】:

我需要在 xamarin 表单中生成产品订单样式表。我搜索了很多,但我没有找到一个例子。 如附图所示。

你能帮帮我吗?提前致谢。

【问题讨论】:

  • 这是一个数据网格。有多种开源和商业选项可供选择

标签: visual-studio xaml xamarin.forms


【解决方案1】:

如果你想要一种快速/专业的方式,你可以试试 Synfucion DataGrid

你也可以使用Grid来达到效果。

例如:

<StackLayout >
  <Grid BackgroundColor="Black" HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand" RowSpacing="1" ColumnSpacing="1" >
      <Grid.RowDefinitions>
          <RowDefinition Height="40" />
          <RowDefinition Height="40" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
           <ColumnDefinition Width="*" />
           <ColumnDefinition Width="*" />
           <ColumnDefinition Width="*" />
           <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
            <Label Grid.Column="0" Grid.Row="0" Text="Name" BackgroundColor="LightGreen" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="1" Grid.Row="0" Text="My name" BackgroundColor="White" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="2" Grid.Row="0" Text="City" BackgroundColor="LightGreen" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="3" Grid.Row="0" Text="MyCity"  BackgroundColor="White" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="0" Grid.Row="1" Text="Address " BackgroundColor="LightGreen" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="1" Grid.Row="1" Text="My Address1234" BackgroundColor="White" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="2" Grid.Row="1" Text="Country" BackgroundColor="LightGreen" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            <Label Grid.Column="3" Grid.Row="1" Text="MyCountry" BackgroundColor="White" TextColor="Black" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>

    </Grid>

</StackLayout>

【讨论】:

    猜你喜欢
    • 2018-12-30
    • 1970-01-01
    • 1970-01-01
    • 2017-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多