1 using System.Collections.Generic;
3 using Tizen.NUI.BaseComponents;
4 using Tizen.NUI.Components;
6 namespace Tizen.NUI.Samples
8 public class ThemeResourceSample : IExample
10 Dictionary<string, string> DefaultThemeResources { get; } = new Dictionary<string, string>()
12 {"ButtonBackgroundColorNormal", "0.054, 0.631, 0.921, 1" },
13 {"ButtonBackgroundColorPressed", "0.454, 0.752, 0.905, 1" },
14 {"ButtonBackgroundColorDisabled", "0.88, 0.88, 0.88, 1" },
16 Dictionary<string, string> DarkThemeResources { get; } = new Dictionary<string, string>()
18 {"ButtonBackgroundColorNormal", "0.309, 0.309, 0.309, 1" },
19 {"ButtonBackgroundColorPressed", "0.631, 0.631, 0.631, 1" },
20 {"ButtonBackgroundColorDisabled", "0.8, 0.8, 0.8, 1" },
22 public void Activate()
24 bool isCurrentThemeDefault = true;
26 View root = new View();
27 root.WidthSpecification = LayoutParamPolicies.MatchParent;
28 root.HeightSpecification = LayoutParamPolicies.MatchParent;
29 Window.Instance.GetDefaultLayer().Add(root);
31 Button button = new Button();
32 button.ThemeChangeSensitive = true;
33 button.Size = new Size2D(200, 200);
34 button.Clicked += (object sender, ClickedEventArgs e) =>
36 if (isCurrentThemeDefault)
38 isCurrentThemeDefault = false;
39 ThemeManager.UpdateCurrentThemeResources(DarkThemeResources);
43 isCurrentThemeDefault = true;
44 ThemeManager.UpdateCurrentThemeResources(DefaultThemeResources);
50 public void Deactivate() {}