Main Query => I have created a listview of certain data and there the data is coming from backend code( Accessing some API ).And presents the
elements of listview with some lebel in MainPage.xaml in a grid format. The Height of Grid is not adjusting with whole Grid
content automatically.
I set HeightRequest = 50, But as a result some data is pushed under the bottom line of the Grid.
I want the height of the grid to adjust the space needed to display different size of the grid value and to compact it,will be No pushed
under data.
** Simplification => How to set the grid height to Auto ?**
Answers
<Grid VerticleOptions = "StartAndExpand"/>
@Sourav2903 can you share the example code with Grid. We can set "Auto" as height of the row, for example the grid below shows a textbox and a button in the first and second row. And the rest of the space is taken by the ListView in the 3rd row.
Key points there:
The
Grid
will auto-adjust size automatically to fit its content BY DEFAULT. If you are overriding theHeightRequest
then it will stop doing that and do what you tell it.You can set the
Height
of aGrid.Row
- but you're talking about setting theHeight
of theGrid
itself.Stop trying to set the
Height
of theGrid
and let it do its job. Just worry about the contentRow
s andColumn
s.@ClintStLaurent Hey..!! Thanks for paying attention to my problem. As per your reply I
1. Removed HeightRequest
2. Modified VerticalOptions of Grid to StartAndExpand
But still same result as earlier.
@ClintStLaurent I got your point.Proceeding to solve the problem keeping that in mind. Thank you..!!
A screen shot of what you're getting... especialy if you can mark what you want versus what you get will help others envision the problem. That's the thing about UI: Its a very visual issue.
This is I am getting.But there are 3 more row in right side column under Date3. They are not showing pushed under the grid bottom line.
I want to Make them all visible and the grid height will adjust as per the data in row of each column and The Edit Student Details will be in first column just left of last line of right side column.
@ClintStLaurent Hey..Plaese reply me.Here's the problem I am getting.
1 - Can you provide the XAML markup used to create that latest layout from your screenshot?
2 - Do I understand correctly that the problem is:
• There is more content after
Date3
block, but theGrid
is not expanding to show it.Is that right?
My first thought is: Since that's a list of dates, why not just put in a
ListView
to show them all?@Sourav2903 use ScrollView as a parent for Grid