StackLayout: Children property cannot be assigned to

Viewed 532

I have this simple piece of code in Xamarin.Forms:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;

namespace ReflectedColors
{
    public class ColorBlocksPage : ContentPage
    {
        public ColorBlocksPage()
        {
            Content = new StackLayout
            {

            };
        }
    }
}

I click on c inside the StackLayout member initializer so as to set the Children collection and I get:

enter image description here

As you can Children is not there.

If I try to write

Content = new StackLayout
{
    Children = new Label { Text = "Test"}
};

I get the following error when trying to build my solution:

Error CS0200 Property or indexer 'Layout.Children' cannot be assigned to -- it is read only

I must be doing something stupid but unfortunately have no clue on what could be the source of this problem.

1 Answers
Related