Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
4.6 kB
7
Indexable
Never
This code will display the data to your mobile device,
this will be placed in .XAML file.


<CollectionView
    x:Name="ListSchools"
    Grid.Row="3"
    Margin="20">
    <CollectionView.ItemsLayout>
        <GridItemsLayout Orientation="Vertical" Span="1" />
    </CollectionView.ItemsLayout>
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <ContentView Padding="2">
                <Border
                    Margin="0"
                    Padding="0"
                    BackgroundColor="{StaticResource Primary}"
                    HeightRequest="100"
                    Stroke="{StaticResource TextSoft}"
                    StrokeShape="RoundRectangle 20"
                    StrokeThickness="0">
                    <Grid ColumnDefinitions="Auto, *">
                        <Line
                            Grid.Column="0"
                            BackgroundColor="{StaticResource ButtonColor}"
                            WidthRequest="5" />
                        <StackLayout
                            Grid.Column="1"
                            Margin="15"
                            BackgroundColor="Transparent"
                            HorizontalOptions="Fill"
                            Orientation="Horizontal">
                            <Grid
                                ColumnDefinitions="Auto, *"
                                RowDefinitions="Auto, Auto, Auto"
                                RowSpacing="0">
                                <Label
                                    Grid.Row="0"
                                    Grid.Column="0"
                                    FontSize="15"
                                    HorizontalOptions="Start"
                                    LineBreakMode="TailTruncation"
                                    Text="School ID:"
                                    TextColor="{StaticResource TextSoft}"
                                    VerticalOptions="Center" />
                                <Label
                                    Grid.Row="0"
                                    Grid.Column="1"
                                    FontAttributes="Bold"
                                    FontSize="15"
                                    LineBreakMode="TailTruncation"
                                    Text="{Binding SchoolID}"
                                    TextColor="{StaticResource TextColorWhite}" />

                                <Label
                                    Grid.Row="1"
                                    Grid.Column="0"
                                    FontSize="15"
                                    HorizontalOptions="Start"
                                    Text="School name:"
                                    TextColor="{StaticResource TextSoft}"
                                    VerticalOptions="CenterAndExpand" />
                                <Label
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    FontAttributes="Bold"
                                    FontSize="15"
                                    LineBreakMode="TailTruncation"
                                    Text="{Binding SchoolName}"
                                    TextColor="{StaticResource TextColorWhite}" />
                                <Label
                                    Grid.Row="2"
                                    Grid.Column="0"
                                    FontSize="15"
                                    HorizontalOptions="Start"
                                    Text="School address:"
                                    TextColor="{StaticResource TextSoft}"
                                    VerticalOptions="CenterAndExpand" />
                                <Label
                                    Grid.Row="2"
                                    Grid.Column="1"
                                    FontAttributes="Bold"
                                    FontSize="15"
                                    LineBreakMode="TailTruncation"
                                    Text="{Binding SchoolAddress}"
                                    TextColor="{StaticResource TextColorWhite}" />
                            </Grid>
                        </StackLayout>
                    </Grid>
                </Border>
            </ContentView>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>
Leave a Comment