user16937336
user16937336

Reputation:

How to insert multiple items on the same line

I wanted to ask how I could put multiple elements on the same line: label, boxview, label`

    <Grid Margin="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="2" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label x:Name="utente" Padding="10, 0, 0, 0" Grid.Row="0" Grid.Column="0" Text="Profilo + icona" FontSize="Large" TextColor="White"></Label>
                <Label x:Name="lblClick" Padding="0, 0, 10, 0" Grid.Row="0" Grid.Column="2" Text="Logout" FontSize="Large" HorizontalOptions="End" TextColor="White">
                </Label>
                <BoxView Grid.Row="0" Grid.Column="1" Margin="0" BackgroundColor="White" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></BoxView>
            </Grid>

enter image description here

Like this it's okay, only I would like to remove the gap between the horizontal line and the vertical line, I have already tried with the padding and with the margin, but I have not obtained results

Upvotes: 1

Views: 858

Answers (2)

Juan Sturla
Juan Sturla

Reputation: 1304

By default the Grid separates the objects using a Spacing value of 6

Reducing the space between objects in a grid using RowSpacing or ColumnSpacing (it will affect all the grid). Of course, one will affect space between rows and the other between columns.

In your case you want to reduce the space between the rows.

<Grid Margin="0" RowSpacing="0">
            ....Rest of your code...
        </Grid>

Upvotes: 1

Wen xu Li
Wen xu Li

Reputation: 1686

For the vertical white line in your picture, it is due to the use of <BoxView Grid.Row="0" Grid.Column="1" Margin="0" BackgroundColor="White" HorizontalOptions="FillAndExpand" VerticalOptions=" FillAndExpand"></BoxView>.

For the horizontal lines in your picture, it depends on the layout influence outside the Grid.

Upvotes: 1

Related Questions