public CollectionViewTest1()
        {
            InitializeComponent();
            BindingContext = new TestSourceModel();
            var RadioGroup = new RadioButtonGroup();

            RadioGroup.Add(ShowBar);
            RadioGroup.Add(HideBar);

            ColView.ItemTemplate = new DataTemplate(() =>
            {
                var item = new RecyclerViewItem()
                {
                    HeightSpecification = LayoutParamPolicies.MatchParent,
                    WidthSpecification  = 200,
                };
                item.SetBinding(View.BackgroundColorProperty, "BgColor");
                var label = new TextLabel()
                {
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true,
                };
                label.PixelSize = 30;
                label.SetBinding(TextLabel.TextProperty, "Index");
                item.Add(label);

                return(item);
            });
        }
Esempio n. 2
0
        public CollectionViewTest3Page()
        {
            InitializeComponent();
            BindingContext = new TestSourceModel();
            var winSize  = NUIApplication.GetDefaultWindow().WindowSize;
            var itemSize = (winSize.Width / 2);

            ColView.ItemTemplate = new DataTemplate(() =>
            {
                var item = new RecyclerViewItem()
                {
                    WidthSpecification  = itemSize,
                    HeightSpecification = 200,
                };
                item.SetBinding(View.BackgroundColorProperty, "BgColor");
                var label = new TextLabel()
                {
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true,
                };
                label.PixelSize = 30;
                label.SetBinding(TextLabel.TextProperty, "Index");
                item.Add(label);

                return(item);
            });
        }
Esempio n. 3
0
        public CollectionViewTest7()
        {
            InitializeComponent();
            BindingContext = new TestSourceModel(40);

            ColView.ItemTemplate = new DataTemplate(() =>
            {
                var item = new RecyclerViewItem()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 100,
                };
                item.SetBinding(View.BackgroundColorProperty, "BgColor");
                var label = new TextLabel()
                {
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true,
                };
                label.PixelSize = 30;
                label.SetBinding(TextLabel.TextProperty, "Index");
                item.Add(label);

                return(item);
            });
            // Currently ScrollableBase only support Scrolling and ScrollOutOfBound event.
            ColView.Scrolling += OnScrolling;
        }
Esempio n. 4
0
        void HeaderBtnClicked(object sender, ClickedEventArgs e)
        {
            headerClicked = !headerClicked;
            if (headerClicked)
            {
                var item = new RecyclerViewItem()
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = 100,
                    BackgroundColor     = Color.Grey,
                };
                var label = new TextLabel()
                {
                    PixelSize              = 20,
                    Text                   = clickedCount.ToString(),
                    VerticalAlignment      = VerticalAlignment.Center,
                    HorizontalAlignment    = HorizontalAlignment.Begin,
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                    PivotPoint             = Position.PivotPointCenterLeft,
                };
                item.Add(label);
                clickedCount++;

                ColView.Header = item;
            }
            else
            {
                ColView.Header = null;
            }
        }
Esempio n. 5
0
        public CollectionViewTest8Page()
        {
            InitializeComponent();
            BindingContext = new TestSourceModel(40);

            var customStyle = new RecyclerViewItemStyle()
            {
                BackgroundColor = new Selector <Color>()
                {
                    Normal   = Color.White,
                    Pressed  = Color.Red,
                    Selected = Color.Blue,
                    Disabled = Color.Grey,
                },
            };

            ColView.ItemTemplate = new DataTemplate(() =>
            {
                var item = new RecyclerViewItem(customStyle)
                {
                    WidthSpecification  = 100,
                    HeightSpecification = LayoutParamPolicies.MatchParent,
                };
                var label = new TextLabel()
                {
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true,
                };
                label.PixelSize = 30;
                label.SetBinding(TextLabel.TextProperty, "Index");
                item.Add(label);

                return(item);
            });
        }
Esempio n. 6
0
        View CreateListPage(IEnumerable <TestCaseBase> tests)
        {
            var layout = new View
            {
                HeightResizePolicy = ResizePolicyType.FillToParent,
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                Layout             = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };

            EventHandler <ClickedEventArgs> clicked = (object sender, ClickedEventArgs args) =>
            {
                var testCase = ((sender as View).BindingContext as TestCaseBase);
                RunTC(testCase);
            };
            var collectionview = new CollectionView
            {
                SelectionMode      = ItemSelectionMode.None,
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                HeightResizePolicy = ResizePolicyType.FillToParent,
                ItemsLayouter      = new LinearLayouter(),
                ScrollingDirection = ScrollableBase.Direction.Vertical,
                ItemsSource        = tests,
                ItemTemplate       = new DataTemplate(() =>
                {
                    var itemView = new RecyclerViewItem
                    {
                        Layout = new LinearLayout
                        {
                            LinearOrientation = LinearLayout.Orientation.Vertical,
                            LinearAlignment   = LinearLayout.Alignment.Center
                        },
                        WidthResizePolicy = ResizePolicyType.FillToParent,
                        SizeHeight        = 100,
                    };
                    var border = new BorderVisual
                    {
                        Opacity      = 0.8f,
                        CornerRadius = 0,
                        BorderSize   = 1,
                        Color        = Color.Black,
                        AntiAliasing = true,
                    };
                    itemView.AddVisual("border", border);

                    itemView.Clicked += clicked;

                    var label = new TextLabel
                    {
                        VerticalAlignment   = VerticalAlignment.Center,
                        WidthSpecification  = LayoutParamPolicies.MatchParent,
                        HeightSpecification = LayoutParamPolicies.MatchParent,
                    };

                    label.PixelSize = 30;
                    label.SetBinding(TextLabel.TextProperty, new Binding("TestName"));
                    itemView.Add(label);
                    return(itemView);
                    //var itemView = new DefaultLinearItem
                    //{
                    //    WidthResizePolicy = ResizePolicyType.FillToParent,
                    //};

                    //itemView.Clicked += clicked;
                    //itemView.Label.PixelSize = 30;
                    //itemView.Label.SetBinding(TextLabel.TextProperty, new Binding("TestName"));
                    //return itemView;
                })
            };

            layout.Add(collectionview);

            return(layout);
        }