0

Is there a way in Xamarin Forms to set the width of a listview row and not to expand it over the entire screen? I have tried the RequestWidth of the Listview and also worked with Grid and Layouts in ListView.

1 Answer 1

1

The width of a row inside the listview will always take up the entire width of the listview itself. There is no way to have extra space between the end of a Row and the edge of the listview, nor would that make any sense.

What you can do is make the listview itself smaller. For this, you need to give it a position that is NOT "Fill". It's HorizontalLayoutOptions needs to be either Start, Center or End in order to NOT take the entire width.

You can also use StartAndExpand / CenterAndExpand / EndAndExpand if you want the list view to try and force it's parent control to take as much width as is available, even though the list view will still just take the space it "needs" or requests using WidthRequest.

Hope that clears it up a bit, please refer to the Layout documentation for Xamarin.Forms if you're stuck.

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.