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

Auto Sizing Text

$
0
0

I working with an inherited ViewCell and am trying to figure out how to get the text to adjust to the size of the cell. The idea being that I want it to dynamically adjust to the screen size of the device.

`class MenuCell : ViewCell
    {
        public MenuCell()
        {
            var imageImg = new Image
            {
                HorizontalOptions = LayoutOptions.Start,
                HeightRequest = 40
            };
            imageImg.SetBinding(Image.SourceProperty, "ImageUri");
            var textLbl = new Label
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("EEEEEE"),
                TextColor = Color.FromHex("80A7D8"),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            textLbl.SetBinding(Label.TextProperty, "ItemText");
            var layout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal,
                Children ={
                    imageImg,
                    textLbl
                }

            };
            View = layout;
        }



    }`

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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