2 * Copyright(c) 2018 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.
17 using System.ComponentModel;
19 using Tizen.NUI.XamlBinding;
21 namespace Tizen.NUI.Xaml.UIComponents
25 /// A ToggleButton allows the user to change a setting between two or more states.
27 /// <since_tizen> 6 </since_tizen>
28 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class ToggleButton : Button
32 private Tizen.NUI.ToggleButton _toggleButton;
33 internal Tizen.NUI.ToggleButton toggleButton
37 if (null == _toggleButton)
39 _toggleButton = handleInstance as Tizen.NUI.ToggleButton;
47 /// Create an instance for toggleButton.
49 /// <since_tizen> 6 </since_tizen>
50 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
51 [EditorBrowsable(EditorBrowsableState.Never)]
52 public ToggleButton() : this(new Tizen.NUI.ToggleButton())
56 internal ToggleButton(Tizen.NUI.ToggleButton nuiInstance) : base(nuiInstance)
58 SetNUIInstance(nuiInstance);
61 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public static readonly BindableProperty StateVisualsProperty = BindableProperty.Create("StateVisuals", typeof(PropertyArray), typeof(ToggleButton), null, propertyChanged: (bindable, oldValue, newValue) =>
65 var toggleButton = ((ToggleButton)bindable).toggleButton;
66 toggleButton.StateVisuals = (PropertyArray)newValue;
68 defaultValueCreator: (bindable) =>
70 var toggleButton = ((ToggleButton)bindable).toggleButton;
71 return toggleButton.StateVisuals;
73 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public static readonly BindableProperty TooltipsProperty = BindableProperty.Create("Tooltips", typeof(PropertyArray), typeof(ToggleButton), null, propertyChanged: (bindable, oldValue, newValue) =>
77 var toggleButton = ((ToggleButton)bindable).toggleButton;
78 toggleButton.Tooltips = (PropertyArray)newValue;
80 defaultValueCreator: (bindable) =>
82 var toggleButton = ((ToggleButton)bindable).toggleButton;
83 return toggleButton.Tooltips;
85 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
86 [EditorBrowsable(EditorBrowsableState.Never)]
87 public static readonly BindableProperty CurrentStateIndexProperty = BindableProperty.Create("CurrentStateIndex", typeof(int), typeof(ToggleButton), default(int), propertyChanged: (bindable, oldValue, newValue) =>
89 var toggleButton = ((ToggleButton)bindable).toggleButton;
90 toggleButton.CurrentStateIndex = (int)newValue;
92 defaultValueCreator: (bindable) =>
94 var toggleButton = ((ToggleButton)bindable).toggleButton;
95 return toggleButton.CurrentStateIndex;
99 /// Gets and Sets the state visual array of toggle button.
101 /// <since_tizen> 6 </since_tizen>
102 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public PropertyArray StateVisuals
108 return (PropertyArray)GetValue(StateVisualsProperty);
112 SetValue(StateVisualsProperty, value);
117 /// Gets and Sets the tooltips of toggle button.
119 /// <since_tizen> 6 </since_tizen>
120 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public PropertyArray Tooltips
126 return (PropertyArray)GetValue(TooltipsProperty);
130 SetValue(TooltipsProperty, value);
135 /// Gets and Sets the current state index of toggle button.
137 /// <since_tizen> 6 </since_tizen>
138 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
139 [EditorBrowsable(EditorBrowsableState.Never)]
140 public int CurrentStateIndex
144 return (int)GetValue(CurrentStateIndexProperty);
148 SetValue(CurrentStateIndexProperty, value);