2 * Copyright(c) 2019 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;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
20 using Tizen.NUI.Components.Extension;
22 namespace Tizen.NUI.Components
25 /// SwitchStyle is a class which saves Switch's ux data.
27 /// <since_tizen> 8 </since_tizen>
28 public class SwitchStyle : ButtonStyle
30 static SwitchStyle() { }
33 /// Creates a new instance of a SwitchStyle.
35 /// <since_tizen> 8 </since_tizen>
36 public SwitchStyle() : base()
41 /// Creates a new instance of a SwitchStyle with style.
43 /// <param name="style">Create SwitchStyle by style customized by user.</param>
44 /// <since_tizen> 8 </since_tizen>
45 public SwitchStyle(SwitchStyle style) : base(style)
50 /// Thumb image's style.
52 /// <since_tizen> 8 </since_tizen>
53 public ImageViewStyle Thumb { get; set; } = new ImageViewStyle();
56 /// Track image's style.
58 /// <since_tizen> 8 </since_tizen>
59 public ImageViewStyle Track { get; set; } = new ImageViewStyle();
62 /// Style's clone function.
64 /// <param name="bindableObject">The style that need to copy.</param>
65 /// <since_tizen> 8 </since_tizen>
66 public override void CopyFrom(BindableObject bindableObject)
68 base.CopyFrom(bindableObject);
70 if (bindableObject is SwitchStyle switchStyle)
72 Track.CopyFrom(switchStyle.Track);
73 Thumb.CopyFrom(switchStyle.Thumb);
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public override ButtonExtension CreateExtension()
81 return new SlidingSwitchExtension();