【发布时间】:2017-08-06 22:19:09
【问题描述】:
我在 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
{
};
}
}
}
我在StackLayout 成员初始化器中单击c 以设置Children 集合,然后我得到:
你可以Children不在那里。
如果我试着写
Content = new StackLayout
{
Children = new Label { Text = "Test"}
};
尝试构建解决方案时出现以下错误:
错误 CS0200 属性或索引器“Layout.Children”不能 分配给 -- 它是只读的
我一定是在做一些愚蠢的事情,但不幸的是,我不知道这个问题的根源是什么。
【问题讨论】:
标签: c# xamarin xamarin.forms