创建一个可穿戴的Tizen .net应用程序,我创建一个包含CirclePage变量的应用程序:
private CirclePage _mainPage;
然后我用一些Content填充其Content属性:
_mainPage = new CirclePage
{
Content = new StackLayout
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Orientation = StackOrientation.Vertical,
Children = {
new Label { HorizontalTextAlignment = TextAlignment.Center, Text = "Text!" },
button
}
}
};
_mainPage.CircleSurfaceItems.Add(circleSlider);
_mainPage.RotaryFocusObject = circleSlider;
MainPage = _mainPage;
稍后,我想更新该页面并为其提供CircleScrollView:
var circleScrollView = new CircleScrollView
{
Content = new StackLayout
{
Orientation = StackOrientation.Vertical,
Children =
{
new Label { Text = "scroll!" },
new Label { Text = "scroll!" }
}
}
};
_mainPage.Content = circleScrollView;
到目前为止,一切都很好。但是说我要更新该列表,我注意到在创建/初始化之后,似乎没有任何方法可以更新内容的子项,因为子项在创建后才是只读的。
每次列表更改时,我都需要创建一个新的CircleScrollView并填充子级吗?我想我没有任何具体的理由相信这效率低下,但是其他平台(例如苹果和android设备)似乎提供了插入/删除/或更新视图列表的方法。
我是与Tizen接触的品牌菜鸟,因此,如果这似乎是一个虚假的问题,我先向您道歉
(circleScrollView.Content为StackLayout).Children.Add(...)(circleScrollView.Content为StackLayout).Children.Remove(...)
ttps://docs.microsoft.com/ko-kr/dotnet/api/xamarin.forms.layout-1.children?view = xamarin-forms#Xamarin_Forms_Layout_1_Children