hello!,
i have an issue with my frame...
im triyng to scale my frame with the content inside of my listview it sorta looks like
<Frame Grid.Row="2" x:Name="framePeople" TranslationY="-100" HeightRequest="850"> <StackLayout x:Name="StacklayoutPeople"> <ListView x:Name="ListPoeple"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid.ColumnDefinitions> <ColumnDefinition Width="AUTO" /> <ColumnDefinition Width="AUTO" /> <ColumnDefinition Width="AUTO" /> </Grid.ColumnDefinitions> <Label Text="{Binding Voornaam}" FontSize="Medium" FontAttributes="Bold" Grid.Column="0" /> <Label Text="{Binding Achternaam}" Grid.Column="1" FontSize="Medium" HorizontalOptions="Start" /> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout> </Frame>
i don't want to have a heightrequest that just says 850..i wan't to scale it with my current content..
is there an easy way to do this?
Answers
Have you checked out the
Scale
property? Or by Scale do you mean everything fit on the page no matter what the height of the screen is? If that's the case then you need to be using RowDefinitions with your Grid.So if you had two items you wanted to scale to fit the page, You would need 2 Rows.
Star = Take up as much room as possible
Auto = Take up as much room as it needs
30 = Take up specified height, It's like putting a HeightRequest on the element.
@seanyda the content page is scrollable i want to fit the content in the frame.
when i use scale="AUTO" it gives an error (Input string was not in a correct format.)
how can i make the frame scale with the content i have?
Scale doesn't take a string. It takes a double, so e.g 2, 3
But to be honest, I don't understand what you're trying to do, but the scale property probably isn't what you're looking for.
@seanyda
maybe i can explain it a little better.
i have a contentpage wich is scrollable, i have a frame where i load in users from my Database.
the users get put inside of the frame into a stacklayout so they are beneith each other.
but i have to many users and the frame cant show all because of the height,
i don't want to put in a fixed/hardcoded height but i want to scale the amount of users being loaded with the frame's height.
so all users are shown.
If you're showing a list of users inside a
ContentPage
via aListView
you don't need aFrame
or aStackLayout
. You will be handling the height of the cells via yourViewCell
.Unless you have some logic that I can't see for your StackLayout - Your code should be looking like this instead.
Replacing RowHeight with the Height of your Cells.