我有一个水平的stacklayout,但我需要添加一个应该在框架中其他项目之上的按钮。
我尝试添加另一个stacklayout,但它抱怨。
var stackLayout = new StackLayout
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.Center,
Orientation = StackOrientation.Horizontal,
Children = {image, label}
};
var buttonStackLayout = new StackLayout
{
Children = {addButton}
};
return new ViewCell { View = stackLayout};
当我尝试这样做时:
return new ViewCell { View = stackLayout && buttonStackLayout};
它说我不能拥有2个stacklayouts的操作数。
答案 0 :(得分:0)
View = stackLayout&& buttonStackLayout是错误的。
您需要使用:
View = new StackLayout
{
Orientation = StackOrientation.Horizontal,
Children = {stackLayout , buttonStackLayout}
};