在框架中添加两个stacklayots-后面的代码(不是xaml) [英] Add two stacklayots in a frame - code behind (not xaml)

查看:81
本文介绍了在框架中添加两个stacklayots-后面的代码(不是xaml)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个水平的堆栈布局,但是我需要添加一个应该位于框架中其他项目上方的按钮.

I have a stacklayout that is horizontally but i need to add a button that is supposed to be above the other items in the frame.

我尝试添加另一个堆栈布局,但是它抱怨.

I tried adding another stacklayout but it complains.

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个堆栈布局的操作数.

It says I cant have operands of 2 stacklayouts.

推荐答案

View = stackLayout&& buttonStackLayout是错误的.

View = stackLayout && buttonStackLayout is wrong.

您需要使用:

View = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children = {stackLayout , buttonStackLayout}
            };

这篇关于在框架中添加两个stacklayots-后面的代码(不是xaml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆