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 AlertDialogExample : ContentPage, IExample
28 private View rootContent;
29 private Button buttonOneAction, buttonTwoAction, buttonNoTitle, buttonNoMessage;
31 public void Activate()
34 public void Deactivate()
38 /// Modify this method for adding other examples.
39 public AlertDialogExample() : base()
41 WidthSpecification = LayoutParamPolicies.MatchParent;
42 HeightSpecification = LayoutParamPolicies.MatchParent;
44 // Navigator bar title is added here.
47 Title = "AlertDialog Default Style",
50 // Example root content view.
51 // you can decorate, add children on this view.
52 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 buttonOneAction = new Button
68 Name = "buttonOneAction",
69 Text = "Show AlertDialog with one button",
70 WidthSpecification = LayoutParamPolicies.MatchParent,
72 rootContent.Add(buttonOneAction);
74 buttonOneAction.Clicked += (s, e) =>
76 var button = new Button()
81 button.Clicked += (object s, ClickedEventArgs a) =>
86 DialogPage.ShowAlertDialog("Title", "Message", button);
89 buttonTwoAction = new Button
91 Name = "buttonTwoAction",
92 Text = "Show AlertDialog with two buttons",
93 WidthSpecification = LayoutParamPolicies.MatchParent,
95 rootContent.Add(buttonTwoAction);
97 buttonTwoAction.Clicked += (s, e) =>
99 var button = new Button()
104 button.Clicked += (object s, ClickedEventArgs a) =>
109 var button2 = new Button()
114 button2.Clicked += (object s, ClickedEventArgs a) =>
119 DialogPage.ShowAlertDialog("Title", "Message", button, button2);
122 buttonNoTitle = new Button
124 Name = "buttonNoTitle",
125 Text = "Show AlertDialog without title",
126 WidthSpecification = LayoutParamPolicies.MatchParent,
128 rootContent.Add(buttonNoTitle);
130 buttonNoTitle.Clicked += (s, e) =>
132 var button = new Button()
137 button.Clicked += (object s, ClickedEventArgs a) =>
142 var button2 = new Button()
147 button2.Clicked += (object s, ClickedEventArgs a) =>
152 DialogPage.ShowAlertDialog(null, "Message", button, button2);
155 buttonNoMessage = new Button
157 Name = "buttonNoMessage",
158 Text = "Show AlertDialog without message",
159 WidthSpecification = LayoutParamPolicies.MatchParent,
161 rootContent.Add(buttonNoMessage);
163 buttonNoMessage.Clicked += (s, e) =>
165 var button = new Button()
170 button.Clicked += (object s, ClickedEventArgs a) =>
175 var button2 = new Button()
180 button2.Clicked += (object s, ClickedEventArgs a) =>
185 DialogPage.ShowAlertDialog("Title", null, button, button2);
188 Content = rootContent;