2 using System.Collections.Generic;
4 using Tizen.NUI.BaseComponents;
6 namespace Tizen.NUI.Samples
8 public class ScrollableBaseOutOfBoundSample : IExample
11 private Components.ScrollableBase mScrollableBase = null;
12 private TextLabel[] items;
14 public void Activate()
16 Window window = NUIApplication.GetDefaultWindow();
19 Size = new Size(1920, 1080),
20 BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f),
22 root.Layout = new LinearLayout()
24 LinearOrientation = LinearLayout.Orientation.Vertical
28 CreateScrollableBase();
31 private void CreateScrollableBase()
33 mScrollableBase = new Components.ScrollableBase()
35 Position = new Position(300, 100),
36 Size = new Size(400, 300),
37 ScrollingDirection = Components.ScrollableBase.Direction.Vertical,
39 mScrollableBase.ScrollOutOfBound += OnScrollOutOfBound;
41 items = new TextLabel[5];
42 for (int i = 0; i < 5; i++)
44 items[i] = new TextLabel
46 Position = new Position(0, i * 100),
47 Size = new Size(800, 100),
49 TextColor = Color.Black,
53 items[i].BackgroundColor = Color.White;
57 items[i].BackgroundColor = Color.Cyan;
59 mScrollableBase.Add(items[i]);
61 root.Add(mScrollableBase);
64 private void OnScrollOutOfBound(object sender, Components.ScrollOutOfBoundEventArgs e)
66 if (e.ScrollableBound == Components.ScrollOutOfBoundEventArgs.Bound.Top)
68 items[0].Text = "Reached at the top.";
72 items[4].Text = "Reached at the bottom.";
76 public void Deactivate()
78 for (int i = 0; i < 5; i++)
82 mScrollableBase.Remove(items[i]);
86 if (mScrollableBase != null)
88 root.Remove(mScrollableBase);
89 mScrollableBase.Dispose();