2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
21 using Tizen.NUI.Components;
23 namespace Tizen.NUI.StyleGuide
25 // IExample inehrited class will be automatically added in the main examples list.
26 internal class ButtonExample : ContentPage, IExample
28 private Window window;
29 public void Activate()
32 public void Deactivate()
37 /// Modify this method for adding other examples.
38 public ButtonExample() : base()
40 Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n");
42 WidthSpecification = LayoutParamPolicies.MatchParent;
43 HeightSpecification = LayoutParamPolicies.MatchParent;
44 // Navigator bar title is added here.
47 Title = "Button Default Style",
50 // Example root content view.
51 // you can decorate, add children on this view.
52 var rootContent = new View()
54 WidthSpecification = LayoutParamPolicies.MatchParent,
55 HeightSpecification = LayoutParamPolicies.MatchParent,
57 Layout = new LinearLayout()
59 LinearOrientation = LinearLayout.Orientation.Vertical,
60 HorizontalAlignment = HorizontalAlignment.Center,
61 VerticalAlignment = VerticalAlignment.Center,
62 CellPadding = new Size2D(10, 20),
66 // Button style examples.
68 var enabledButton = new Button()
72 enabledButton.Clicked += (object obj, ClickedEventArgs ev) =>
74 Log.Info(this.GetType().Name, "Enabled Button Clicked\n");
76 rootContent.Add(enabledButton);
78 var disabledButton = new Button()
83 disabledButton.EnableFocus();
84 disabledButton.Clicked += (object obj, ClickedEventArgs ev) =>
86 // This event should not be recieved. button is disabled.
87 Log.Info(this.GetType().Name, "Disabled Button Clicked\n");
90 rootContent.Add(disabledButton);
92 var selectableButton = new Button()
97 selectableButton.Clicked += (object obj, ClickedEventArgs ev) =>
99 Log.Info(this.GetType().Name, "Selected Button Clicked\n");
100 if (obj is Button button)
102 disabledButton.IsEnabled = button.IsSelected;
103 if (button.IsSelected)
105 button.Text = "Selected";
109 button.Text = "Unselected";
113 rootContent.Add(selectableButton);
114 Content = rootContent;