1 回答

TA貢獻1804條經(jīng)驗 獲得超3個贊
您可以為您的 StackLayout 添加一個名稱,以便在您的代碼隱藏中引用。
<ScrollView>
<StackLayout x:Name="mainLayout" Padding="20, 20, 20, 20">
<local:TimeSheetAccordion HeaderText="Customer #1" BackgroundColor="#FAFAFA" Padding="20, 20, 20, 20" />
<local:TimeSheetAccordion HeaderText="Customer #2" BackgroundColor="#FAFAFA" Padding="20, 20, 20, 20" />
<StackLayout Margin="0, 30, 0, 0" Orientation="Horizontal" HorizontalOptions="End">
<Button Text="Reset" BorderRadius="6" />
<Button Text="Submit Time Sheet" BackgroundColor="Blue" TextColor="White" BorderRadius="6" />
</StackLayout>
</StackLayout>
</ScrollView>
在此之后,在您的 Page.xaml.cs
mainLayout.Children.Add(new TimeSheetAccordion());
- 1 回答
- 0 關注
- 124 瀏覽
添加回答
舉報