Exemple #1
0
        private void SetupChildren()
        {
            if (ItemSource is ICollection <AchievementTierProgressViewModel> tiers)
            {
                Content.Children.Clear();

                foreach (var tier in tiers)
                {
                    var container = new ContentView()
                    {
                        WidthRequest = ChildWidth,
                    };
                    container.AddTouch((sender, args) =>
                    {
                        ItemTappedCommand?.Execute(tier);
                    });

                    if (ItemTemplate?.CreateContent() is View content)
                    {
                        content.BindingContext = tier;
                        container.Content      = content;
                    }
                    else
                    {
                        container.Content = new Label {
                            Text = tier.ToString()
                        };
                    }
                    Content.Children.Add(container);
                }
                InvalidateLayout();
            }
        }