tizentizen-wearable-sdkxamarin.tizen

Tizen. How to update the Children of a Page Content CircleScrollView


Creating a wearable Tizen .net application, I create an application that contains a CirclePage variable:

private CirclePage _mainPage;

I then populate its Content property with some 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;

At a later point I want to update that page giving it a CircleScrollView:

var circleScrollView = new CircleScrollView
            {
                Content = new StackLayout
                {
                    Orientation = StackOrientation.Vertical,
                    Children =
                    {
                        new Label { Text = "scroll!" },
                        new Label { Text = "scroll!" }
                    }
                }
            };
            _mainPage.Content = circleScrollView;

Everything is fine to this point. But say i want to update that List, I notice that after creation/initialization, there doesn't seem to be any methods to update the Children of the Content as Children are read only after created.

Do i need to create a new CircleScrollView and populate the Children each time my list changes? I suppose i do not have any concrete reason to believe this is inefficient, but other platforms such as apple and android devices seem to provide methods to insert/remove/ or otherwise update a view listing.

Im brand noob with tizen so i apologize in advance if this seems a vapid question


Solution

  • Try the following:

    (circleScrollView.Content as StackLayout).Children.Add(...)
    (circleScrollView.Content as StackLayout).Children.Remove(...)
    

    Check the documentation for more.