ListView custom cell and font size

ListView custom cell and font size

BY 10 Jul 2020 Tizen .NET

I used an example with https://docs.microsoft.com/en-us/dotnet/api/Xamarin.Forms.ListView?view=xamarin-forms

I redid it a bit, and ran into the problem that when I lower the font Label, I reduce the font size, then the last element of the list is not highlighted

Video: https://vimeo.com/437096362

What caused this bug? So the last field is not centered? How then to fix it?

using System;
using System.Collections.Generic;
using System.Text;
using Tizen.Wearable.CircularUI.Forms;
using Xamarin.Forms;

namespace Test.UiComponents
{
    class Person
    {
        public Person(string name, DateTime birthday)
        {
            this.Name = name;
            this.Birthday = birthday;
        }

        public string Name { private set; get; }

        public DateTime Birthday { private set; get; }
    };


    class TestView: CircleListView
    {
        public TestView()
        {
            // Define some data.
            List<Person> people = new List<Person>
            {
                new Person("Abigail", new DateTime(1975, 1, 15)),
                new Person("Bob", new DateTime(1976, 2, 20)),
                // ...etc.,...
                new Person("Yvonne", new DateTime(1987, 1, 10)),
                new Person("Zachary", new DateTime(1988, 2, 5))
            };


            ItemsSource = people;
    
            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for 
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
            {
                // Create views with bindings for displaying each property.
                Label nameLabel = new Label();
                nameLabel.SetBinding(Label.TextProperty, "Name");

                Label birthdayLabel = new Label
                {
                    FontSize = 6
                };
                birthdayLabel.SetBinding(Label.TextProperty,
                    new Binding("Birthday", BindingMode.OneWay,
                        null, null, "Born {0:d}"));

                BoxView boxView = new BoxView();
                boxView.SetBinding(BoxView.ColorProperty, "FavoriteColor");

                // Return an assembled ViewCell.
                return new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(0, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            boxView,
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                Spacing = 0,
                                Children =
                                {
                                    nameLabel,
                                    birthdayLabel
                                }
                                }
                        }
                    }
                };
            });
        }
    }
}
Written by