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

Xamarin.Forms Label won't word wrap inside a Grid

$
0
0

I define a Grid like this:

var easyGrid = new Grid();
easyGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
easyGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

I then populate the Grid with text and bullets (emulating a bulleted list) like so:

for (int i = 0; i < bullets.Length; i++) {
    easyGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });

    var label = new Label { Text = "•" };
    label.SetValue(Grid.RowProperty, i);
    easyGrid.Children.Add(label);

    var text = new Label { Text = bullets[i] };
    text.SetValue(Grid.RowProperty, i);
    text.SetValue(Grid.ColumnProperty, 1);
    easyGrid.Children.Add(text);
}

But on iOS the Label controls don't word wrap as they do outside a Grid layout control. Is this a bug with Xamarin.Forms on iOS? Otherwise how do I get them to word-wrap?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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