2 using Tizen.NUI.BaseComponents;
3 using Tizen.NUI.Components;
5 namespace NUITizenGallery
7 public partial class ShadowFrameTest1Page : ContentPage
9 private bool shadowToggleShow; // true if we show shadow
10 private Shadow CreateShadowFromeSliders()
14 ShadowBlurRadius.CurrentValue,
16 ShadowColorRed.CurrentValue / 255.0f,
17 ShadowColorGreen.CurrentValue / 255.0f,
18 ShadowColorBlue.CurrentValue / 255.0f,
19 ShadowOpacity.CurrentValue / 255.0f),
21 ShadowOffsetX.CurrentValue,
22 ShadowOffsetY.CurrentValue)
25 public ShadowFrameTest1Page()
27 InitializeComponent();
28 shadowToggleShow = true;
31 CornerTopLeft.ValueChanged += (o, e) =>
33 Vector4 currentCornerRadius = target.CornerRadius;
34 target.CornerRadius = new Vector4(CornerTopLeft.CurrentValue, currentCornerRadius.Y, currentCornerRadius.Z, currentCornerRadius.W);
36 CornerTopRight.ValueChanged += (o, e) =>
38 Vector4 currentCornerRadius = target.CornerRadius;
39 target.CornerRadius = new Vector4(currentCornerRadius.X, CornerTopRight.CurrentValue, currentCornerRadius.Z, currentCornerRadius.W);
41 CornerBottomRight.ValueChanged += (o, e) =>
43 Vector4 currentCornerRadius = target.CornerRadius;
44 target.CornerRadius = new Vector4(currentCornerRadius.X, currentCornerRadius.Y, CornerBottomRight.CurrentValue, currentCornerRadius.W);
46 CornerBottomLeft.ValueChanged += (o, e) =>
48 Vector4 currentCornerRadius = target.CornerRadius;
49 target.CornerRadius = new Vector4(currentCornerRadius.X, currentCornerRadius.Y, currentCornerRadius.Z, CornerBottomLeft.CurrentValue);
52 // Borderline Width/Offset
53 BorderlineWidthSlider.ValueChanged += (o, e) =>
55 target.BorderlineWidth = BorderlineWidthSlider.CurrentValue;
57 BorderlineOffsetSlider.ValueChanged += (o, e) =>
59 target.BorderlineOffset = BorderlineOffsetSlider.CurrentValue;
63 BorderlineRed.ValueChanged += (o, e) =>
65 Color currentColor = target.BorderlineColor;
66 target.BorderlineColor = new Color(BorderlineRed.CurrentValue / 255.0f, currentColor.G, currentColor.B, currentColor.A);
68 BorderlineGreen.ValueChanged += (o, e) =>
70 Color currentColor = target.BorderlineColor;
71 target.BorderlineColor = new Color(currentColor.R, BorderlineGreen.CurrentValue / 255.0f, currentColor.B, currentColor.A);
73 BorderlineBlue.ValueChanged += (o, e) =>
75 Color currentColor = target.BorderlineColor;
76 target.BorderlineColor = new Color(currentColor.R, currentColor.G, BorderlineBlue.CurrentValue / 255.0f, currentColor.A);
78 BorderlineAlpha.ValueChanged += (o, e) =>
80 Color currentColor = target.BorderlineColor;
81 target.BorderlineColor = new Color(currentColor.R, currentColor.G, currentColor.B, BorderlineAlpha.CurrentValue / 255.0f);
85 ViewRed.ValueChanged += (o, e) =>
87 Color currentColor = target.BackgroundColor;
88 target.BackgroundColor = new Color(ViewRed.CurrentValue / 255.0f, currentColor.G, currentColor.B, currentColor.A);
90 ViewGreen.ValueChanged += (o, e) =>
92 Color currentColor = target.BackgroundColor;
93 target.BackgroundColor = new Color(currentColor.R, ViewGreen.CurrentValue / 255.0f, currentColor.B, currentColor.A);
95 ViewBlue.ValueChanged += (o, e) =>
97 Color currentColor = target.BackgroundColor;
98 target.BackgroundColor = new Color(currentColor.R, currentColor.G, ViewBlue.CurrentValue / 255.0f, currentColor.A);
100 ViewAlpha.ValueChanged += (o, e) =>
102 Color currentColor = target.BackgroundColor;
103 target.BackgroundColor = new Color(currentColor.R, currentColor.G, currentColor.B, ViewAlpha.CurrentValue / 255.0f);
107 ShadowToggleButton.Clicked += (o, e) =>
109 if(ShadowToggleButton.IsSelected)
111 shadowToggleShow = true;
115 shadowToggleShow = false;
120 if(target.BoxShadow == null)
122 target.BoxShadow = CreateShadowFromeSliders();
127 if(target.BoxShadow != null)
129 target.BoxShadow = null;
134 ShadowOffsetX.ValueChanged += (o, e) =>
136 if(!shadowToggleShow) return;
137 Shadow currentShadow = target.BoxShadow;
138 if(currentShadow == null)
140 target.BoxShadow = CreateShadowFromeSliders();
143 Vector2 currentOffset = currentShadow.Offset;
144 target.BoxShadow = new Shadow(currentShadow.BlurRadius, currentShadow.Color, new Vector2(ShadowOffsetX.CurrentValue, currentOffset.Y));
146 ShadowOffsetY.ValueChanged += (o, e) =>
148 if(!shadowToggleShow) return;
149 Shadow currentShadow = target.BoxShadow;
150 if(currentShadow == null)
152 target.BoxShadow = CreateShadowFromeSliders();
155 Vector2 currentOffset = currentShadow.Offset;
156 target.BoxShadow = new Shadow(currentShadow.BlurRadius, currentShadow.Color, new Vector2(currentOffset.X, ShadowOffsetY.CurrentValue));
160 ShadowColorRed.ValueChanged += (o, e) =>
162 if(!shadowToggleShow) return;
163 Shadow currentShadow = target.BoxShadow;
164 if(currentShadow == null)
166 target.BoxShadow = CreateShadowFromeSliders();
169 Color currentColor = currentShadow.Color;
170 target.BoxShadow = new Shadow(currentShadow.BlurRadius, new Color(ShadowColorRed.CurrentValue / 255.0f, currentColor.G, currentColor.B, currentColor.A), currentShadow.Offset);
172 ShadowColorGreen.ValueChanged += (o, e) =>
174 if(!shadowToggleShow) return;
175 Shadow currentShadow = target.BoxShadow;
176 if(currentShadow == null)
178 target.BoxShadow = CreateShadowFromeSliders();
181 Color currentColor = currentShadow.Color;
182 target.BoxShadow = new Shadow(currentShadow.BlurRadius, new Color(currentColor.R, ShadowColorGreen.CurrentValue / 255.0f, currentColor.B, currentColor.A), currentShadow.Offset);
184 ShadowColorBlue.ValueChanged += (o, e) =>
186 if(!shadowToggleShow) return;
187 Shadow currentShadow = target.BoxShadow;
188 if(currentShadow == null)
190 target.BoxShadow = CreateShadowFromeSliders();
193 Color currentColor = currentShadow.Color;
194 target.BoxShadow = new Shadow(currentShadow.BlurRadius, new Color(currentColor.R, currentColor.G, ShadowColorBlue.CurrentValue / 255.0f, currentColor.A), currentShadow.Offset);
196 ShadowOpacity.ValueChanged += (o, e) =>
198 if(!shadowToggleShow) return;
199 Shadow currentShadow = target.BoxShadow;
200 if(currentShadow == null)
202 target.BoxShadow = CreateShadowFromeSliders();
205 Color currentColor = currentShadow.Color;
206 target.BoxShadow = new Shadow(currentShadow.BlurRadius, new Color(currentColor.R, currentColor.G, currentColor.B, ShadowOpacity.CurrentValue / 255.0f), currentShadow.Offset);
209 ShadowBlurRadius.ValueChanged += (o, e) =>
211 if(!shadowToggleShow) return;
212 Shadow currentShadow = target.BoxShadow;
213 if(currentShadow == null)
215 target.BoxShadow = CreateShadowFromeSliders();
218 float currentRadius = ShadowBlurRadius.CurrentValue;
219 target.BoxShadow = new Shadow(currentRadius, currentShadow.Color, currentShadow.Offset);