泰森。如何更新页面内容 CircleScrollView 的子项
Tizen. How to update the Children of a Page Content CircleScrollView
创建可穿戴 Tizen .net 应用程序,我创建了一个包含 CirclePage 变量的应用程序:
private CirclePage _mainPage;
然后我用一些内容填充它的内容属性:
_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;
至此一切都很好。
但是说我想更新那个列表,我注意到在 creation/initialization 之后,似乎没有任何方法可以更新内容的子项,因为子项在创建后是只读的。
我是否需要在每次列表更改时创建一个新的 CircleScrollView 并填充子项?
我想我没有任何具体的理由相信这是低效的,但其他平台(例如 apple 和 android 设备似乎提供了 insert/remove/ 或以其他方式更新视图列表的方法。
我是 tizen 的新手,所以如果这个问题看起来很乏味,我提前道歉
尝试以下操作:
(circleScrollView.Content as StackLayout).Children.Add(...)
(circleScrollView.Content as StackLayout).Children.Remove(...)
查看 the documentation 了解更多。
创建可穿戴 Tizen .net 应用程序,我创建了一个包含 CirclePage 变量的应用程序:
private CirclePage _mainPage;
然后我用一些内容填充它的内容属性:
_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;
至此一切都很好。 但是说我想更新那个列表,我注意到在 creation/initialization 之后,似乎没有任何方法可以更新内容的子项,因为子项在创建后是只读的。
我是否需要在每次列表更改时创建一个新的 CircleScrollView 并填充子项? 我想我没有任何具体的理由相信这是低效的,但其他平台(例如 apple 和 android 设备似乎提供了 insert/remove/ 或以其他方式更新视图列表的方法。
我是 tizen 的新手,所以如果这个问题看起来很乏味,我提前道歉
尝试以下操作:
(circleScrollView.Content as StackLayout).Children.Add(...)
(circleScrollView.Content as StackLayout).Children.Remove(...)
查看 the documentation 了解更多。