使用C#作为背景代码在Xamarin表单的框架内创建StackLayout

问题描述 投票:2回答:1

我像这样在<Frame>页面中使用xaml

<StackLayout>
    <Frame>
        <StackLayout>
            <Button></Button>
            <Label></Label>
        </StackLayout>
        <StackLayout>
            <Label></Label>
        </StackLayout>
    </Frame>
</StackLayout>

但是我想在C#方面做同样的事情。

我定义了StackLayoutLabelButton

现在,我可以使用ButtonStackLayout添加到Children,但是由于StackLayout没有Frame属性,因此无法将其添加到Children

是否可以使用C#作为背景代码在StackLayout中添加Frame

c# xamarin xamarin.forms code-behind children
1个回答
8
投票
© www.soinside.com 2019 - 2024. All rights reserved.