Esempio n. 1
0
        public BubbleTreeView(List <T> sourceItems)
        {
            ToolBarItemSelectionMode = new ToolbarItem("Navigation Mode", "", () =>
            {
                SelectionModeEnabled = !SelectionModeEnabled;
            }, ToolbarItemOrder.Primary);

            ToolbarItems.Add(ToolBarItemSelectionMode);

            var scrollContainer = new ScrollView();

            scrollContainer.Scrolled += (sender, args) =>
            {
                var scrollSpace = scrollContainer.ContentSize.Height - scrollContainer.Height - 20;
                if (scrollSpace <= args.ScrollY)
                {
                    //TODO: Add Scroll Pagination
                    //Container.Children.Add(new Label() { TextColor = Color.White, Text = "Another Element!" });
                    //Container.Children.Add(new Label() { TextColor = Color.White, Text = "Another Element2!" });
                    //Container.Children.Add(new Label() { TextColor = Color.White, Text = "Another Element3!" });
                }
            };

            Container = new StackLayout();
            scrollContainer.Content = Container;
            SearchContainer         = new StackLayout();
            BubbleContainer         = new Grid();

            Container.Children.Add(SearchContainer);
            Container.Children.Add(BubbleContainer);

            BubbleNodes = NodeFactory <T> .CreateFromSource(sourceItems, node => node.Data.Description, orderDescending : true);

            SearchEntry.TextChanged += OnTextChangedDoSearch();
            SearchEntry.Placeholder  = SearchingOnRootText;

            Content = scrollContainer;
            SearchContainer.Children.Add(SearchEntry);

            //var rootNodesCount = BubbleNodes.RawList.OfType<RootNode<T>>().Count();
            //PrepareBubbleContainer(rootNodesCount, DisplayNumberOfColumns);
        }
Esempio n. 2
0
        public BubbleTreeView(List <T> sourceItems)
        {
            var scrollContainer = new ScrollView();

            scrollContainer.Scrolled += (sender, args) =>
            {
                var scrollSpace = scrollContainer.ContentSize.Height - scrollContainer.Height - 20;
                if (scrollSpace <= args.ScrollY)
                {
                    Container.Children.Add(new Label()
                    {
                        TextColor = Color.White, Text = "Another Element!"
                    });
                    Container.Children.Add(new Label()
                    {
                        TextColor = Color.White, Text = "Another Element2!"
                    });
                    Container.Children.Add(new Label()
                    {
                        TextColor = Color.White, Text = "Another Element3!"
                    });
                }
            };

            Container = new StackLayout();
            scrollContainer.Content = Container;
            SearchContainer         = new StackLayout();
            BubbleContainer         = new Grid();

            Container.Children.Add(SearchContainer);
            Container.Children.Add(BubbleContainer);

            BubbleNodes = NodeFactory <T> .CreateFromSource(sourceItems, node => node.Data.Description, orderDescending : true);

            SearchEntry.TextChanged += OnTextChangedDoSearch();

            ToolbarItems.Add(new ToolbarItem("To Root", "ToRootIcon.png", () => CurrentSearchFilterNode = null)
            {
                Text = "Raiz"
            });
            GoToParentToolbarItem = new ToolbarItem("To parent", "ToParentIcon.png", () =>
            {
                if (CurrentSearchFilterNode is RootNode <T> )
                {
                    CurrentSearchFilterNode = null;
                }
                if (CurrentSearchFilterNode is InternalNode <T> )
                {
                    CurrentSearchFilterNode = ((InternalNode <T>)CurrentSearchFilterNode).Parent;
                }
                if (CurrentSearchFilterNode is LeafNode <T> )
                {
                    CurrentSearchFilterNode = ((LeafNode <T>)CurrentSearchFilterNode).Parent;
                }
            })
            {
                Text = "Subir"
            };

            Content = scrollContainer;
            SearchContainer.Children.Add(SearchEntry);

            var rootNodesCount = BubbleNodes.RawList.OfType <RootNode <T> >().Count();

            PrepareBubbleContainer(rootNodesCount, 3);
        }