Languages

Menu
Sites
Language
ListView custom cell and font size

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
                                }
                                }
                        }
                    }
                };
            });
        }
    }
}
Edited by: Ivan Kudryavsky on 12 Jul, 2020

Responses

3 Replies
Ivan Kudryavsky
Updated the link to the video https://vimeo.com/437096362
 
Tizen .NET

Thank you for reaching us.

This is related to Tizen's UX policy. 
For more details, please refer to the link.

And if you have any furthrer questions about Circular UI, please visit the project home and ask.

Thank you.

Tizen .NET

Thank you for reaching us.

 

This is related to Tizen's UX policy. 
For more details, please refer to the link.

 

And if you have any furthrer questions about Circular UI, please visit the project home and ask.

Thank you.