Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to get word-wrap working with MinimumHeightRequest in a grid

$
0
0

I've managed to implement a Grid using XF (see attached screenshot), that contains Labels (which are themselves inside StackLayouts) with Word Wrap enabled. To get this to work, I have to explicitly set the Width of the Grid ColumnDefinitions and do a WidthRequest on the contained Labels. This still doesn't quite achieve the desired effect, as the Labels get cropped vertically, rather than the Grid rows automatically re-sizing. Any MinimumHeightRequest that I set seems to be ignored (I think this must be a XF bug). Only by explicitly setting the Height of the RowDefinitions, can I achieve what appears to be ok. Unfortunately, even that is an illusion, as on a small screen the required Height for the Label to be displayed correctly may be greater than the value I give to the Height of the RowDefinition.

Does anybody know of a way to get a Grid to re-size each row automatically, to fit contained word-wrapped text (with padding around it provided by the StackLayout), and to have a MinimumHeightRequest that works (so that people with large fingers will press the intended hyperlink)?

The structure I have is Label inside StackLayout repeated for each child position in the Grid.

Many thanks,

John H.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>