1

in my XAML I have this grid:

            <Grid Grid.Row="12"  Grid.Column="1" ColumnSpacing="0" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <!--Label-->
                    <RowDefinition Height="3*" ></RowDefinition>
                    <!--ProfilePic-->
                    <RowDefinition Height="*"></RowDefinition>
                    <!-- Btn change-->
                </Grid.RowDefinitions>


                <BoxView BackgroundColor="Purple" Grid.Row="1"></BoxView>

                <ImageButton  
                    Grid.Row="2"
                    x:Name="row_forpic_editProfile"
                    HorizontalOptions="Center"
                    VerticalOptions="Center"
                />

                <Label
                    Grid.Row="0"
                    FontSize="16"
                    TextColor="#272727"
                    VerticalOptions="End"
                    Text="Proilfbild"
                    FontFamily="arial"
                />


                <Button  
                    Grid.Row="2"
                    x:Name="btn_changepic_editprofile"
                    Text="Ändern"
                    HorizontalOptions="Center"
                    VerticalOptions="Center"
                />
            </Grid>

This is the result of that:

The result

Now, I want to add an imageview into the purple row (which is Grid.Row="1") from code because I downloaded a picture from the internet.

How can I now add my new Image (ImageButton) into this exact row? (row 1) And also have it maintain its dimensions (only the picture must full the container).

thank you:)

1 Answer 1

1

to add a View to a Grid

myGrid.Children.Add(view,col,row);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.