2 using Tizen.NUI.BaseComponents;
4 using Tizen.NUI.Components;
7 namespace Tizen.NUI.Samples
9 public class ScrollableFocusSample2 : IExample
14 public void Activate()
16 Window window = NUIApplication.GetDefaultWindow();
19 root.Layout = new AbsoluteLayout();
20 root.Size = new Size(300, 800);
22 root.BackgroundColor = Color.White;
25 FocusManager.Instance.EnableDefaultAlgorithm(true);
26 root.Layout = new AbsoluteLayout();
27 root.WidthSpecification = LayoutParamPolicies.MatchParent;
28 root.HeightSpecification = LayoutParamPolicies.MatchParent;
31 _label = new TextLabel();
33 _label.Position = new Position(0, 0);
34 _label.SizeWidth = 300;
35 _label.SizeHeight = 100;
37 var topPanel = new View
39 Layout = new LinearLayout
41 LinearOrientation = LinearLayout.Orientation.Vertical
43 WidthSpecification = LayoutParamPolicies.MatchParent,
44 HeightSpecification = LayoutParamPolicies.MatchParent,
47 for (int i = 0; i < 10; i++)
49 topPanel.Add(CreateButton(i, false));
52 topPanel.Position = new Position(0, 100);
54 var bottomPanel = new View
56 Layout = new LinearLayout
58 LinearOrientation = LinearLayout.Orientation.Vertical,
60 BackgroundColor = Color.Yellow,
61 WidthSpecification = LayoutParamPolicies.MatchParent,
65 for (int i = 0; i < 10; i++)
67 bottomPanel.Add(CreateButton(11 + i, true));
70 root.Add(bottomPanel);
71 bottomPanel.Position = new Position(0, 500);
73 topPanel.RaiseToTop();
77 View CreateButton(int index, bool second)
79 var rnd = new Random();
84 FocusableInTouch = true,
85 Text = $"Item {index}",
88 btn.BackgroundColor = Color.Red;
90 btn.WidthSpecification = LayoutParamPolicies.MatchParent;
93 btn.FocusGained += (s, e) =>
95 btn.Text = $"[Item {index}]";
96 _label.Text = btn.Text;
98 btn.FocusLost += (s, e) =>
100 btn.Text = $"Item {index}";
106 public void Deactivate()
110 NUIApplication.GetDefaultWindow().Remove(root);