-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainView.ux
74 lines (60 loc) · 2.09 KB
/
MainView.ux
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<App>
<ux:Include File="FontAwesome.ux" />
<Font File="Roboto-Regular.ttf" ux:Global="RobotoRegular" />
<JavaScript>
var Observable = require("FuseJS/Observable");
var dropdown = Observable({
options : Observable({ value: "Red", key:"red", content: [1,0,0,1]} ,
{ value: "Green", key:"green", content: [0,1,0,1]} ,
{ value: "Blue", key:"blue", content: [0,0,1,1]}),
selected : Observable("Red"),
callback : function(arg){
var options = dropdown.value.options.toArray();
var found;
for(var i=0; i < options.length;i++){
if(options[i].key === arg.key){
found = options[i];
break;
}
}
if(found){
dropdown.value.selected.value = found.value;
selectedColor.value = found.content;
}
}
});
var dropdown2 = Observable({
options : Observable( { value: "Yellow", key:"yellow", content: [1,1,0,1]} ,
{ value: "Teal",key:"teal", content: [0,1,1,1]} ,
{ value: "Magenta", key:"magenta", content: [1,0,1,1]}),
selected : Observable("Yellow"),
callback : function(arg){
var options = dropdown2.value.options.toArray();
var found;
for(var i=0; i < options.length;i++){
if(options[i].key === arg.key){
found = options[i];
break;
}
}
if(found){
dropdown2.value.selected.value = found.value;
selectedColor.value = found.content;
}
}
});
var selectedColor = Observable([1,0,0,1] );
module.exports = {
selectedColor: selectedColor,
dropdown: dropdown,
dropdown2: dropdown2
}
</JavaScript>
<StackPanel>
<Panel Height="40">
<SolidColor Color="{selectedColor}"/>
</Panel>
<DropDown Object="{dropdown}" />
<DropDown Object="{dropdown2}" />
</StackPanel>
</App>