-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcomponents.js
More file actions
59 lines (48 loc) · 1.75 KB
/
Copy pathcomponents.js
File metadata and controls
59 lines (48 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import {
createButton,
createCard,
safeGetChildrenSize,
text,
} from "../core/ui.js";
export function createComponentsPage() {
const root = new Windows.UI.Xaml.Controls.StackPanel();
root.Spacing = 12;
root.Children.Append(text("Components Lab", 34));
const description = text(
"This tab demonstrates real WinRT controls manipulated from JavaScript event handlers.",
14,
);
description.TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap;
root.Children.Append(description);
const toggle = new Windows.UI.Xaml.Controls.ToggleSwitch();
toggle.Header = "Enable runtime polish";
toggle.IsOn = true;
const slider = new Windows.UI.Xaml.Controls.Slider();
slider.Minimum = 0;
slider.Maximum = 100;
slider.Value = 40;
slider.Width = 360;
const progress = new Windows.UI.Xaml.Controls.ProgressBar();
progress.Minimum = 0;
progress.Maximum = 100;
progress.Value = 40;
progress.Width = 360;
const status = text("State: polish enabled at 40%", 13);
const applyButton = createButton("Apply Slider To Progress", function () {
progress.Value = slider.Value;
status.Text = "State: " + (toggle.IsOn ? "polish enabled" : "polish disabled") + " at " + Math.round(slider.Value) + "%";
});
root.Children.Append(toggle);
root.Children.Append(slider);
root.Children.Append(progress);
root.Children.Append(applyButton);
root.Children.Append(status);
root.Children.Append(
createCard(
"Copyable Pattern",
"Instantiate controls, keep references, and update state on click handlers.",
),
);
console.log("NativeScriptWindowsDemo: components children", safeGetChildrenSize(root));
return root;
}