C# 在哪个控件中,我可以在Xamarin.Forms XAML中添加多个值

C# 在哪个控件中,我可以在Xamarin.Forms XAML中添加多个值,c#,xaml,xamarin.forms,C#,Xaml,Xamarin.forms,单击“+”按钮后,我希望允许用户添加另一个值。我怎样才能做到这一点 您可以创建一个水平堆栈布局,当您单击一个按钮时,您可以将一个子对象添加到您的添加按钮后面的堆栈布局 XAMLStackLayout: <StackLayout x:Name="layout" Orientation="Horizontal"> <Button Image="plus.png" Clicked="ButtonClicked"/> </StackLayout> 看看我的图

单击“+”按钮后,我希望允许用户添加另一个值。我怎样才能做到这一点


您可以创建一个水平
堆栈布局
,当您单击一个按钮时,您可以将一个子对象添加到您的添加按钮后面的
堆栈布局

XAML
StackLayout

<StackLayout x:Name="layout" Orientation="Horizontal">
    <Button Image="plus.png" Clicked="ButtonClicked"/>
</StackLayout>

看看我的图像:没有像这样的内置控件
void ButtonClicked(object sender, EventArgs args)
{
    var newItem = ...; // create a new layout item

    // insert the new item right before the button in the stacked layout
    layout.Children.Insert(layout.Children.Count - 1, newItem);
}