Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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:local="clr-namespace:GridSample"
x:Class="GridSample.GridSamplePage">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="headerTablet" TargetType="Label">
<Setter Property="TextColor" Value="White" />
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="BackgroundColor" Value="Silver" />
<Setter Property="VerticalTextAlignment" Value="Center" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
</Style>
<Style x:Key="detailTablet" TargetType="Label">
<Setter Property="TextColor" Value="Black" />
<Setter Property="BackgroundColor" Value="White" />
<Setter Property="VerticalTextAlignment" Value="Center" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<Grid VerticalOptions="CenterAndExpand" Margin="10" Padding="1" BackgroundColor="Silver" RowSpacing="1" ColumnSpacing="1">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Label Text="First name" Grid.Row="0" Style="{DynamicResource headerTablet}"/>
<Label Text="Last name" Grid.Column="1" Grid.Row="0" Style="{DynamicResource headerTablet}"/>
<Label Text="Gender" Grid.Column="2" Grid.Row="0" Style="{DynamicResource headerTablet}"/>
<Label Text="Charlin" Grid.Column="0" Grid.Row="1" Style="{DynamicResource detailTablet}"/>
<Label Text="Agramonte" Grid.Column="1" Grid.Row="1" Style="{DynamicResource detailTablet}"/>
<Label Text="Female" Grid.Column="2" Grid.Row="1" Style="{DynamicResource detailTablet}"/>
</Grid>
</ContentPage>
@arvindrajachourasiya

This comment has been minimized.

Show comment
Hide comment
@arvindrajachourasiya

arvindrajachourasiya Jul 24, 2018

@charlin,
This layout looks beautiful. Here from 2nd row onward if I want to bind data dynamically how could I do that?

arvindrajachourasiya commented Jul 24, 2018

@charlin,
This layout looks beautiful. Here from 2nd row onward if I want to bind data dynamically how could I do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment