[NUI] replace field declaration with property (#1701)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / DropDown.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.Collections.Generic;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
21 using Tizen.NUI.Binding;
22
23 namespace Tizen.NUI.Components
24 {
25     /// <summary>
26     /// DropDown is one kind of common component, a dropdown allows the user click dropdown button to choose one value from a list.
27     /// </summary>
28     /// <since_tizen> 6 </since_tizen>
29     /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
30     [EditorBrowsable(EditorBrowsableState.Never)]
31     public class DropDown : Control
32     {
33         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
34         [EditorBrowsable(EditorBrowsableState.Never)]
35         public static readonly BindableProperty ListPaddingProperty = BindableProperty.Create(nameof(ListPadding), typeof(Extents), typeof(DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
36         {
37             var instance = (DropDown)bindable;
38             if (newValue != null)
39             {
40                 instance.listPadding.CopyFrom((Extents)newValue);
41                 instance.UpdateDropDown();
42             }
43         },
44         defaultValueCreator: (bindable) =>
45         {
46             var instance = (DropDown)bindable;
47             return instance.listPadding;
48         });
49         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
50         [EditorBrowsable(EditorBrowsableState.Never)]
51         public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create(nameof(SelectedItemIndex), typeof(int), typeof(DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
52         {
53             var instance = (DropDown)bindable;
54             if (newValue != null)
55             {
56                 int selectedItemIndex = (int)newValue;
57                 if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex < 0 || selectedItemIndex >= instance.adapter.GetItemCount())
58                 {
59                     return;
60                 }
61                 instance.SetListItemToSelected((uint)selectedItemIndex);
62             }
63         },
64         defaultValueCreator: (bindable) =>
65         {
66             var instance = (DropDown)bindable;
67             return instance.selectedItemIndex;
68         });
69         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
70         [EditorBrowsable(EditorBrowsableState.Never)]
71         public static readonly BindableProperty ListMarginProperty = BindableProperty.Create(nameof(ListMargin), typeof(Extents), typeof(DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
72         {
73             var instance = (DropDown)bindable;
74             if (newValue != null)
75             {
76                 instance.listMargin.CopyFrom((Extents)newValue);
77                 instance.UpdateDropDown();
78             }
79         },
80         defaultValueCreator: (bindable) =>
81         {
82             var instance = (DropDown)bindable;
83             return instance.listMargin;
84         });
85         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
86         [EditorBrowsable(EditorBrowsableState.Never)]
87         public static readonly BindableProperty ListRelativeOrientationProperty = BindableProperty.Create(nameof(ListRelativeOrientation), typeof(ListOrientation), typeof(DropDown), ListOrientation.Left, propertyChanged: (bindable, oldValue, newValue) =>
88         {
89             var instance = (DropDown)bindable;
90             if (newValue != null)
91             {
92                 instance.listRelativeOrientation = (ListOrientation)newValue;
93                 instance.UpdateDropDown();
94             }
95         },
96         defaultValueCreator: (bindable) =>
97         {
98             var instance = (DropDown)bindable;
99             return instance.listRelativeOrientation;
100         });
101         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
102         [EditorBrowsable(EditorBrowsableState.Never)]
103         public static readonly BindableProperty SpaceBetweenButtonTextAndIconProperty = BindableProperty.Create(nameof(SpaceBetweenButtonTextAndIcon), typeof(int), typeof(DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
104         {
105             var instance = (DropDown)bindable;
106             if (newValue != null)
107             {
108                 instance.spaceBetweenButtonTextAndIcon = (int)newValue;
109             }
110         },
111         defaultValueCreator: (bindable) =>
112         {
113             var instance = (DropDown)bindable;
114             return instance.spaceBetweenButtonTextAndIcon;
115         });
116
117         #region DropDown
118         private Button button = null;
119         private TextLabel headerText = null;
120         private TextLabel buttonText = null;
121         private ImageView listBackgroundImage = null;
122         // Component that scrolls the child added to it.
123         private ScrollableBase scrollableBase = null;
124
125         // The LinearLayout container to house the items in the drop down list.
126         private View dropDownMenuFullList = null;
127         private DropDownListBridge adapter = new DropDownListBridge();
128         private DropDownItemView selectedItemView = null;
129         private TapGestureDetector tapGestureDetector = null;
130
131         private Extents listMargin = new Extents(0, 0, 0, 0);
132         private Extents listPadding = new Extents(0, 0, 0, 0);
133         private ListOrientation listRelativeOrientation = ListOrientation.Left;
134         private int selectedItemIndex = -1;
135         private int spaceBetweenButtonTextAndIcon = 0;
136         private bool itemPressed = false;
137
138         static DropDown() { }
139
140         /// <summary>
141         /// Creates a new instance of a DropDown.
142         /// </summary>
143         /// <since_tizen> 6 </since_tizen>
144         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
145         [EditorBrowsable(EditorBrowsableState.Never)]
146         public DropDown() : base() { }
147
148         /// <summary>
149         /// Creates a new instance of a DropDown with style.
150         /// </summary>
151         /// <param name="style">Create DropDown by special style defined in UX.</param>
152         /// <since_tizen> 6 </since_tizen>
153         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
154         [EditorBrowsable(EditorBrowsableState.Never)]
155         public DropDown(string style) : base(style) { }
156
157         /// <summary>
158         /// Creates a new instance of a DropDown with style.
159         /// </summary>
160         /// <param name="dropDownStyle">Create DropDown by style customized by user.</param>
161         /// <since_tizen> 6 </since_tizen>
162         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
163         [EditorBrowsable(EditorBrowsableState.Never)]
164         public DropDown(DropDownStyle dropDownStyle) : base(dropDownStyle)
165         {
166         }
167
168         /// <summary>
169         /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
170         /// </summary>
171         /// <since_tizen> 6 </since_tizen>
172         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
173         [EditorBrowsable(EditorBrowsableState.Never)]
174         public delegate void ClickEventHandler<ClickEventArgs>(object sender, ClickEventArgs e);
175
176         /// <summary>
177         /// An event for the item clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
178         /// </summary>
179         /// <since_tizen> 6 </since_tizen>
180         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
181         [EditorBrowsable(EditorBrowsableState.Never)]
182         public event ClickEventHandler<ItemClickEventArgs> ItemClickEvent;
183
184         /// <summary>
185         /// List position in relation to the main button.
186         /// </summary>
187         /// <since_tizen> 6 </since_tizen>
188         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
189         [EditorBrowsable(EditorBrowsableState.Never)]
190         public enum ListOrientation
191         {
192             /// <summary>
193             /// Left.
194             /// </summary>
195             /// <since_tizen> 6 </since_tizen>
196             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
197             [EditorBrowsable(EditorBrowsableState.Never)]
198             Left,
199             /// <summary>
200             /// Right.
201             /// </summary>
202             /// <since_tizen> 6 </since_tizen>
203             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
204             [EditorBrowsable(EditorBrowsableState.Never)]
205             Right,
206         }
207
208         /// <summary>
209         /// Get or set header text.
210         /// </summary>
211         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
212         [EditorBrowsable(EditorBrowsableState.Never)]
213         public TextLabel HeaderText
214         {
215             get
216             {
217                 if (null == headerText)
218                 {
219                     headerText = new TextLabel()
220                     {
221                         WidthResizePolicy = ResizePolicyType.UseNaturalSize,
222                         HeightResizePolicy = ResizePolicyType.UseNaturalSize,
223                         HorizontalAlignment = HorizontalAlignment.Center,
224                         VerticalAlignment = VerticalAlignment.Center,
225                         ParentOrigin = NUI.ParentOrigin.Center,
226                         PivotPoint = NUI.ParentOrigin.Center,
227                         PositionUsesPivotPoint = true,
228                         Name = "DropDownHeaderText"
229                     };
230                     Add(headerText);
231                 }
232                 return headerText;
233             }
234             internal set
235             {
236                 headerText = value;
237             }
238         }
239
240         /// <summary>
241         /// Get or set button.
242         /// </summary>
243         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
244         [EditorBrowsable(EditorBrowsableState.Never)]
245         public Button Button
246         {
247             get
248             {
249                 if (null == button)
250                 {
251                     button = new Button()
252                     {
253                         ParentOrigin = NUI.ParentOrigin.CenterLeft,
254                         PivotPoint = NUI.PivotPoint.CenterLeft,
255                         PositionUsesPivotPoint = true,
256                         HeightResizePolicy = ResizePolicyType.FitToChildren,
257                         IconRelativeOrientation = Button.IconOrientation.Right,
258                         Name = "DropDownButton"
259                     };
260                     button.ClickEvent += ButtonClickEvent;
261                     Add(button);
262
263                     if (null == buttonText)
264                     {
265                         buttonText = new TextLabel();
266                     }
267                 }
268                 return button;
269             }
270             internal set
271             {
272                 button = value;
273             }
274         }
275
276         /// <summary>
277         /// Get or set the background image of list.
278         /// </summary>
279         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
280         [EditorBrowsable(EditorBrowsableState.Never)]
281         public ImageView ListBackgroundImage
282         {
283             get
284             {
285                 if (null == listBackgroundImage)
286                 {
287                     listBackgroundImage = new ImageView()
288                     {
289                         Name = "ListBackgroundImage",
290                         PositionUsesPivotPoint = true,
291                         ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
292                         PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
293                         WidthResizePolicy = ResizePolicyType.FitToChildren,
294                         HeightResizePolicy = ResizePolicyType.FitToChildren,
295                     };
296                     Add(listBackgroundImage);
297
298                     if (null == scrollableBase) // scrollableBase used to test of ListContainer Setup invoked already
299                     {
300                         SetUpListContainer();
301                     }
302                 }
303                 return listBackgroundImage;
304             }
305             internal set
306             {
307                 listBackgroundImage = value;
308             }
309         }
310
311         /// <summary>
312         /// Return a copied Style instance of DropDown
313         /// </summary>
314         /// <remarks>
315         /// It returns copied Style instance and changing it does not effect to the DropDown.
316         /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
317         /// </remarks>
318         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
319         [EditorBrowsable(EditorBrowsableState.Never)]
320         //public new DropDownStyle Style
321         //{
322         //    get
323         //    {
324         //        return new DropDownStyle(ViewStyle as DropDownStyle);
325         //    }
326         //}
327         public new DropDownStyle Style => ViewStyle as DropDownStyle;
328
329         /// <summary>
330         /// Space between button text and button icon in DropDown.
331         /// </summary>
332         /// <since_tizen> 6 </since_tizen>
333         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
334         public int SpaceBetweenButtonTextAndIcon
335         {
336             get => (int)GetValue(SpaceBetweenButtonTextAndIconProperty);
337             set => SetValue(SpaceBetweenButtonTextAndIconProperty, value);
338         }
339
340         /// <summary>
341         /// List relative orientation in DropDown.
342         /// </summary>
343         /// <since_tizen> 6 </since_tizen>
344         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
345         public ListOrientation ListRelativeOrientation
346         {
347             get => (ListOrientation)GetValue(ListRelativeOrientationProperty);
348             set => SetValue(ListRelativeOrientationProperty, value);
349         }
350
351         /// <summary>
352         /// Space in list.
353         /// </summary>
354         /// <since_tizen> 6 </since_tizen>
355         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
356         public Extents ListMargin
357         {
358             get
359             {
360                 Extents tmp = (Extents)GetValue(ListMarginProperty);
361                 return new Extents((ushort start, ushort end, ushort top, ushort bottom) => { ListMargin = new Extents(start, end, top, bottom); }, tmp.Start, tmp.End, tmp.Top, tmp.Bottom);
362             }
363             set => SetValue(ListMarginProperty, value);
364         }
365
366         /// <summary>
367         /// Selected item index in list.
368         /// </summary>
369         /// <since_tizen> 6 </since_tizen>
370         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
371         public int SelectedItemIndex
372         {
373             get => (int)GetValue(SelectedItemIndexProperty);
374             set => SetValue(SelectedItemIndexProperty, value);
375         }
376
377         /// <summary>
378         /// List padding in DropDown.
379         /// </summary>
380         /// <since_tizen> 6 </since_tizen>
381         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
382         public Extents ListPadding
383         {
384             get
385             {
386                 Extents tmp = (Extents)GetValue(ListPaddingProperty);
387                 return new Extents((ushort start, ushort end, ushort top, ushort bottom) => { ListPadding = new Extents(start, end, top, bottom); }, tmp.Start, tmp.End, tmp.Top, tmp.Bottom);
388             }
389             set => SetValue(ListPaddingProperty, value);
390         }
391
392         /// <summary>
393         /// Add list item by item data. The added item will be added to end of all items automatically.
394         /// </summary>
395         /// <param name="itemData">Item data which will apply to tab item view.</param>
396         /// <since_tizen> 6 </since_tizen>
397         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
398         [EditorBrowsable(EditorBrowsableState.Never)]
399         public void AddItem(DropDownDataItem itemData)
400         {
401            // Add item to adaptor, will be added to list via AddItemAt during OnUpdate()
402            int insertionPosition = adapter.GetItemCount();
403            adapter.InsertData(insertionPosition, itemData);
404         }
405
406         /// <summary>
407         /// Delete list item by index.
408         /// </summary>
409         /// <param name="index">Position index where will be deleted.</param>
410         /// <since_tizen> 6 </since_tizen>
411         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
412         [EditorBrowsable(EditorBrowsableState.Never)]
413         public void DeleteItem(int index)
414         {
415             if (index < 0 || index >= adapter?.GetItemCount()) return;
416             if (null == dropDownMenuFullList) return;
417
418             if (selectedItemIndex == index)
419             {
420                 selectedItemIndex = -1;
421             }
422             else if(selectedItemIndex > index)
423             {
424                 selectedItemIndex--;
425             }
426
427             adapter?.RemoveData(index);
428
429             if(index < dropDownMenuFullList.ChildCount)
430             {
431                 View childToRemove = dropDownMenuFullList.GetChildAt((uint)index);
432                 if (childToRemove)
433                 {
434                     childToRemove.TouchEvent -= ListItemTouchEvent;
435                     dropDownMenuFullList.Remove(childToRemove);
436                     dropDownMenuFullList?.Layout?.RequestLayout();
437                 }
438             }
439         }
440
441         /// <summary>
442         /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
443         /// </summary>
444         /// <param name="item">Item data which will apply to tab item view.</param>
445         /// <param name="index">Position index where will be inserted.</param>
446         /// <since_tizen> 6 </since_tizen>
447         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
448         [EditorBrowsable(EditorBrowsableState.Never)]
449         public void InsertItem(DropDownDataItem item, int index)
450         {
451             if (index < 0 || index >= adapter.GetItemCount())
452             {
453                 return;
454             }
455
456             if (selectedItemIndex >= index)
457             {
458                 selectedItemIndex++;
459             }
460
461             adapter.InsertData(index, item);
462         }
463
464         /// <summary>
465         /// Add scroll bar to list.
466         /// </summary>
467         /// <param name="scrollBar">Scroll bar defined by user which will be added to list.</param>
468         /// <since_tizen> 6 </since_tizen>
469         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
470         [EditorBrowsable(EditorBrowsableState.Never)]
471         public void AttachScrollBar(ScrollBar scrollBar)
472         {
473             if (scrollableBase == null)
474             {
475                 return;
476             }
477             Tizen.Log.Error("DropDown","Feature unsupported");
478         }
479
480         /// <summary>
481         /// Detach scroll bar to list.
482         /// </summary>
483         /// <since_tizen> 6 </since_tizen>
484         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
485         [EditorBrowsable(EditorBrowsableState.Never)]
486         public void DetachScrollBar()
487         {
488             if (scrollableBase == null)
489             {
490                 return;
491             }
492             Tizen.Log.Error("DropDown","Feature unsupported");
493         }
494
495         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
496         [EditorBrowsable(EditorBrowsableState.Never)]
497         public override void ApplyStyle(ViewStyle viewStyle)
498         {
499             base.ApplyStyle(viewStyle);
500
501             DropDownStyle dropDownStyle = viewStyle as DropDownStyle;
502             if (null != dropDownStyle)
503             {
504                 if (null != dropDownStyle.Button)
505                 {
506                     Button.ApplyStyle(dropDownStyle.Button);
507                 }
508                 if (null != dropDownStyle.HeaderText)
509                 {
510                     HeaderText.ApplyStyle(dropDownStyle.HeaderText);
511                 }
512                 if (null != dropDownStyle.ListBackgroundImage)
513                 {
514                     ListBackgroundImage.ApplyStyle(dropDownStyle.ListBackgroundImage);
515                 }
516                 UpdateDropDown();
517             }
518         }
519
520         /// <summary>
521         /// Update DropDown by style.
522         /// </summary>
523         /// <since_tizen> 6 </since_tizen>
524         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
525         [EditorBrowsable(EditorBrowsableState.Never)]
526         protected void UpdateDropDown()
527         {
528             if (null == scrollableBase || null == listBackgroundImage || null == dropDownMenuFullList) return;
529             if (null == Style.ListBackgroundImage.Size) return;
530             // Resize and position scrolling list within the drop down list container.  Can be used to position list in relation to the background image.
531             scrollableBase.Size = Style.ListBackgroundImage.Size - new Size((listPadding.Start + listPadding.End), (listPadding.Top + listPadding.Bottom), 0);
532             scrollableBase.Position2D = new Position2D(listPadding.Start, listPadding.Top);
533
534             int listBackgroundImageX = 0;
535             int listBackgroundImageY = 0;
536             if (listRelativeOrientation == ListOrientation.Left)
537             {
538                 listBackgroundImageX = (int)listMargin.Start;
539                 listBackgroundImageY = (int)listMargin.Top;
540             }
541             else if (listRelativeOrientation == ListOrientation.Right)
542             {
543                 listBackgroundImageX = -(int)listMargin.End;
544                 listBackgroundImageY = (int)listMargin.Top;
545             }
546             listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
547             dropDownMenuFullList?.Layout?.RequestLayout();
548         }
549
550         /// <summary>
551         /// update.
552         /// </summary>
553         protected override void OnUpdate()
554         {
555             float buttonTextWidth = 0;
556             if (null != buttonText)
557             {
558                 buttonText.Text = Style.Button.Text.Text.All;
559                 buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? StyleManager.PointSizeNormal;
560                 buttonTextWidth = buttonText.NaturalSize.Width;
561             }
562             float fitWidth = (Style.Button.Icon.Size?.Width ?? 48) + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
563             fitWidth += (button.IconPadding.Start + button.IconPadding.End);
564             button.Size.Width = Math.Max(button.Size.Width, fitWidth);
565             RelayoutRequest();
566
567             int numberOfItemsToAdd = adapter.GetItemCount();
568
569             if (adapter.AdapterPurge == true)
570             {
571                 adapter.AdapterPurge = false;
572                 for (int i = 0; i < numberOfItemsToAdd; i++)
573                 {
574                     AddItemAt(adapter.GetData(i), i);
575                 }
576             }
577             // Set selection icon on View
578             if (selectedItemIndex > 0)
579             {
580                 SetListItemToSelected((uint)selectedItemIndex, selectedItemView);
581             }
582         }
583
584         /// <summary>
585         /// Dispose DropDown and all children on it.
586         /// </summary>
587         /// <param name="type">Dispose type.</param>
588         /// <since_tizen> 6 </since_tizen>
589         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
590         [EditorBrowsable(EditorBrowsableState.Never)]
591         protected override void Dispose(DisposeTypes type)
592         {
593             if (disposed)
594             {
595                 return;
596             }
597
598             if (type == DisposeTypes.Explicit)
599             {
600                 Utility.Dispose(headerText);
601                 Utility.Dispose(buttonText);
602                 Utility.Dispose(button);
603                 Utility.Dispose(scrollableBase);
604                 Utility.Dispose(dropDownMenuFullList);
605                 Utility.Dispose(listBackgroundImage);
606             }
607
608             base.Dispose(type);
609         }
610
611         /// <summary>
612         /// Get DropDown style.
613         /// </summary>
614         /// <returns>The default dropdown style.</returns>
615         /// <since_tizen> 6 </since_tizen>
616         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
617         [EditorBrowsable(EditorBrowsableState.Never)]
618         protected override ViewStyle CreateViewStyle()
619         {
620             return new DropDownStyle();
621         }
622
623         private void AddItemAt(DropDownDataItem itemData,int index)
624         {
625             ViewHolder viewHolder = adapter.OnCreateViewHolder();
626             if (!viewHolder.IsBound)
627             {
628                 adapter.BindViewHolder(viewHolder, index);
629                 viewHolder.IsBound = true;
630             }
631
632             if (tapGestureDetector == null)
633             {
634                 tapGestureDetector = new TapGestureDetector();
635             }
636             View view = viewHolder.ItemView;
637             view.ApplyStyle(itemData.itemDataStyle);
638             view.TouchEvent += ListItemTouchEvent;
639             dropDownMenuFullList.Add(view);
640         }
641
642         private void OnClickEvent(object sender, ItemClickEventArgs e)
643         {
644             ItemClickEvent?.Invoke(sender, e);
645         }
646
647         private void CreateButtonText()
648         {
649             if (null == buttonText)
650             {
651                 buttonText = new TextLabel();
652             }
653         }
654
655         private void CreateButton()
656         {
657             if (null == button)
658             {
659                 button = new Button()
660                 {
661                     ParentOrigin = NUI.ParentOrigin.CenterLeft,
662                     PivotPoint = NUI.PivotPoint.CenterLeft,
663                     PositionUsesPivotPoint = true,
664                     HeightResizePolicy = ResizePolicyType.FitToChildren,
665                     IconRelativeOrientation = Button.IconOrientation.Right,
666                 };
667                 button.Name = "DropDownButton";
668                 button.ClickEvent += ButtonClickEvent;
669                 Add(button);
670             }
671         }
672
673         private void SetUpListContainer()
674         {
675             LinearLayout linear = new LinearLayout()
676             {
677                 LinearOrientation = LinearLayout.Orientation.Vertical,
678             };
679
680             dropDownMenuFullList = new View()
681             {
682                 Layout = linear,
683                 Name = "DropDownMenuList",
684                 WidthSpecification = LayoutParamPolicies.MatchParent,
685                 HeightSpecification = LayoutParamPolicies.WrapContent,
686                 Focusable = true,
687             };
688
689             scrollableBase = new ScrollableBase()
690             {
691                 Name = "Scrollable",
692             };
693             scrollableBase.Add(dropDownMenuFullList);
694
695             listBackgroundImage.Add(scrollableBase);
696             listBackgroundImage.Hide();
697         }
698
699         private View GetViewFromIndex(uint index)
700         {
701             if ((index < dropDownMenuFullList.ChildCount) && (index >=0) )
702             {
703                 return dropDownMenuFullList.GetChildAt(index);
704             }
705             else
706             {
707                 return null;
708             }
709         }
710
711         private void SetListItemToSelected(DropDownItemView view)
712         {
713             if (dropDownMenuFullList == null || view == null || view == selectedItemView)
714             {
715                 return;
716             }
717
718             uint newSelectedIndex = 0;
719             for (; newSelectedIndex < dropDownMenuFullList.ChildCount; newSelectedIndex++)
720             {
721                 var itemView = dropDownMenuFullList.GetChildAt(newSelectedIndex) as DropDownItemView;
722                 if (itemView == view)
723                 {
724                     SetListItemToSelected(newSelectedIndex, view);
725                     return;
726                 }
727             }
728         }
729
730         private void SetListItemToSelected(uint index)
731         {
732             if (dropDownMenuFullList == null || index == selectedItemIndex)
733             {
734                 return;
735             }
736
737             SetListItemToSelected(index, GetViewFromIndex(index) as DropDownItemView);
738         }
739
740         private void SetListItemToSelected(uint index, DropDownItemView view)
741         {
742             if (adapter == null)
743             {
744                 return;
745             }
746
747             if (selectedItemView != null)
748             {
749                 selectedItemView.IsSelected = false;
750                 selectedItemView.ControlState = ControlStates.Normal;
751                 adapter.GetData(selectedItemIndex).IsSelected = false;
752             }
753
754             if (view == null || index >= dropDownMenuFullList.ChildCount)
755             {
756                 selectedItemIndex = -1;
757                 selectedItemView = null;
758                 return;
759             }
760
761             selectedItemIndex = (int)index;
762             selectedItemView = view;
763             selectedItemView.ControlState = ControlStates.Selected;
764             selectedItemView.IsSelected = true;
765             adapter.GetData(selectedItemIndex).IsSelected = true;
766             dropDownMenuFullList.Layout?.RequestLayout();
767         }
768
769         private bool ListItemTouchEvent(object sender, TouchEventArgs e)
770         {
771             PointStateType state = e.Touch.GetState(0);
772             DropDownItemView touchedView = sender as DropDownItemView;;
773             switch (state)
774             {
775                 case PointStateType.Down:
776                     if (touchedView != null)
777                     {
778                         touchedView.ControlState = ControlStates.Pressed;
779                     }
780                     itemPressed = true;  // if matched with a Up then a click event.
781                     break;
782                 case PointStateType.Motion:
783                     if (touchedView != null)
784                     {
785                         touchedView.ControlState = ControlStates.Normal;
786                     }
787                     itemPressed = false;
788                     break;
789                 case PointStateType.Up:
790                     if (touchedView != null)
791                     {
792                         if (itemPressed)  // if Down was previously sent without motion (Scrolling) in-between then a clicked event occurred.
793                         {
794                             // List item clicked
795                             Console.WriteLine("Tapped{0}", touchedView.Name);
796                             SetListItemToSelected(touchedView);
797                             button.Text = touchedView.Text;
798                             button.Show();
799                             listBackgroundImage.Hide();
800                         }
801                     }
802                     break;
803                 default:
804                     break;
805             }
806             return true;
807         }
808
809         private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
810         {
811             button.Hide();
812             listBackgroundImage.Show();
813             dropDownMenuFullList?.Layout?.RequestLayout();
814             listBackgroundImage.RaiseToTop();
815         }
816
817         #endregion
818
819         #region ItemClickEventArgs
820         /// <summary>
821         /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
822         /// </summary>
823         /// <since_tizen> 6 </since_tizen>
824         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
825         [EditorBrowsable(EditorBrowsableState.Never)]
826         public class ItemClickEventArgs : EventArgs
827         {
828             /// <summary> Clicked item index of DropDown's list </summary>
829             /// <since_tizen> 6 </since_tizen>
830             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
831             [EditorBrowsable(EditorBrowsableState.Never)]
832             public int Index { get; set; }
833             /// <summary> Clicked item text string of DropDown's list </summary>
834             /// <since_tizen> 6 </since_tizen>
835             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
836             [EditorBrowsable(EditorBrowsableState.Never)]
837             public string Text { get; set; }
838         }
839         #endregion
840
841         #region DropDownDataItem
842         /// <summary>
843         /// DropDownDataItem is a class to record all data which will be applied to DropDown item.
844         /// </summary>
845         /// <since_tizen> 6 </since_tizen>
846         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
847         //[EditorBrowsable(EditorBrowsableState.Never)]
848         public class DropDownDataItem
849         {
850             internal DropDownItemStyle itemDataStyle = new DropDownItemStyle();
851
852             /// <summary>
853             /// Creates a new instance of a DropDownItemData.
854             /// </summary>
855             /// <since_tizen> 6 </since_tizen>
856             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
857             [EditorBrowsable(EditorBrowsableState.Never)]
858             public DropDownDataItem()
859             {
860                 itemDataStyle = (DropDownItemStyle)StyleManager.Instance.GetComponentStyle(this.GetType());
861                 Initialize();
862             }
863
864             /// <summary>
865             /// Creates a new instance of a DropDownItemData with style.
866             /// </summary>
867             /// <param name="style">Create DropDownItemData by special style defined in UX.</param>
868             /// <since_tizen> 6 </since_tizen>
869             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
870             [EditorBrowsable(EditorBrowsableState.Never)]
871             public DropDownDataItem(string style)
872             {
873                 if(style != null)
874                 {
875                     ViewStyle viewStyle = StyleManager.Instance.GetViewStyle(style);
876                     if(viewStyle == null)
877                     {
878                         throw new InvalidOperationException($"There is no style {style}");
879                     }
880                     itemDataStyle = viewStyle as DropDownItemStyle;
881                 }
882                 Initialize();
883             }
884
885             /// <summary>
886             /// Creates a new instance of a DropDownItemData with style.
887             /// </summary>
888             /// <param name="style">Create DropDownItemData by style customized by user.</param>
889             /// <since_tizen> 6 </since_tizen>
890             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
891             [EditorBrowsable(EditorBrowsableState.Never)]
892             public DropDownDataItem(DropDownItemStyle style)
893             {
894                 itemDataStyle.CopyFrom(style);
895                 Initialize();
896             }
897
898             /// <summary>
899             /// DropDown item size.
900             /// </summary>
901             /// <since_tizen> 6 </since_tizen>
902             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
903             [EditorBrowsable(EditorBrowsableState.Never)]
904             public Size Size
905             {
906                 get
907                 {
908                     return itemDataStyle.Size;
909                 }
910                 set
911                 {
912                     itemDataStyle.Size = value;
913                 }
914             }
915
916             /// <summary>
917             /// DropDown item background color selector.
918             /// </summary>
919             /// <since_tizen> 6 </since_tizen>
920             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
921             [EditorBrowsable(EditorBrowsableState.Never)]
922             public Selector<Color> BackgroundColor
923             {
924                 get
925                 {
926                     return itemDataStyle.BackgroundColor;
927                 }
928                 set
929                 {
930                     if (null == itemDataStyle?.BackgroundColor)
931                     {
932                         itemDataStyle.BackgroundColor = new Selector<Color>();
933                     }
934
935                     itemDataStyle.BackgroundColor.Clone(value);
936                 }
937             }
938
939             /// <summary>
940             /// DropDown item text string.
941             /// </summary>
942             /// <since_tizen> 6 </since_tizen>
943             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
944             [EditorBrowsable(EditorBrowsableState.Never)]
945             public string Text
946             {
947                 get
948                 {
949                     return itemDataStyle.Text?.Text?.All;
950                 }
951                 set
952                 {
953                     if (null == itemDataStyle.Text.Text)
954                     {
955                         itemDataStyle.Text.Text = new Selector<string> { All = value };
956                     }
957                     else
958                     {
959                         itemDataStyle.Text.Text = value;
960                     }
961                 }
962             }
963
964             /// <summary>
965             /// DropDown item text's point size.
966             /// </summary>
967             /// <since_tizen> 6 </since_tizen>
968             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
969             [EditorBrowsable(EditorBrowsableState.Never)]
970             public float PointSize
971             {
972                 get
973                 {
974                     return itemDataStyle.Text?.PointSize?.All ?? 0;
975                 }
976                 set
977                 {
978                     if (null == itemDataStyle.Text.PointSize)
979                     {
980                         itemDataStyle.Text.PointSize = new Selector<float?> { All = value };
981                     }
982                     else
983                     {
984                         itemDataStyle.Text.PointSize = value;
985                     }
986                 }
987             }
988
989             /// <summary>
990             /// DropDown item text's font family.
991             /// </summary>
992             /// <since_tizen> 6 </since_tizen>
993             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
994             [EditorBrowsable(EditorBrowsableState.Never)]
995             public string FontFamily
996             {
997                 get
998                 {
999                     return itemDataStyle.Text.FontFamily?.All;
1000                 }
1001                 set
1002                 {
1003                     if (null == itemDataStyle.Text.FontFamily)
1004                     {
1005                         itemDataStyle.Text.FontFamily = new Selector<string> { All = value };
1006                     }
1007                     else
1008                     {
1009                         itemDataStyle.Text.FontFamily = value;
1010                     }
1011                 }
1012             }
1013
1014             /// <summary>
1015             /// DropDown item text's position.
1016             /// </summary>
1017             /// <since_tizen> 6 </since_tizen>
1018             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1019             [EditorBrowsable(EditorBrowsableState.Never)]
1020             public Position TextPosition
1021             {
1022                 get
1023                 {
1024                     return itemDataStyle.Text?.Position;
1025                 }
1026                 set
1027                 {
1028                     itemDataStyle.Text.Position = value;
1029                 }
1030             }
1031
1032             /// <summary>
1033             /// DropDown item's icon's resource url.
1034             /// </summary>
1035             /// <since_tizen> 6 </since_tizen>
1036             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1037             [EditorBrowsable(EditorBrowsableState.Never)]
1038             public string IconResourceUrl
1039             {
1040                 get
1041                 {
1042                     return itemDataStyle.Icon?.ResourceUrl?.All;
1043                 }
1044                 set
1045                 {
1046                     if (null == itemDataStyle.Icon.ResourceUrl)
1047                     {
1048                         itemDataStyle.Icon.ResourceUrl = new Selector<string> { All = value };
1049                     }
1050                     else
1051                     {
1052                         itemDataStyle.Icon.ResourceUrl = value;
1053                     }
1054                 }
1055             }
1056
1057             /// <summary>
1058             /// DropDown item's icon's size.
1059             /// </summary>
1060             /// <since_tizen> 6 </since_tizen>
1061             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1062             [EditorBrowsable(EditorBrowsableState.Never)]
1063             public Size IconSize
1064             {
1065                 get
1066                 {
1067                     return itemDataStyle.Icon?.Size;
1068                 }
1069                 set
1070                 {
1071                     itemDataStyle.Icon.Size = value;
1072                 }
1073             }
1074
1075             /// <summary>
1076             /// DropDown item's icon's position.
1077             /// </summary>
1078             /// <since_tizen> 6 </since_tizen>
1079             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1080             [EditorBrowsable(EditorBrowsableState.Never)]
1081             public Position IconPosition
1082             {
1083                 get
1084                 {
1085                     return itemDataStyle.Icon.Position;
1086                 }
1087                 set
1088                 {
1089                     itemDataStyle.Icon.Position = value;
1090                 }
1091             }
1092
1093             /// <summary>
1094             /// DropDown item's check image's resource url.
1095             /// </summary>
1096             /// <since_tizen> 6 </since_tizen>
1097             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1098             [EditorBrowsable(EditorBrowsableState.Never)]
1099             public string CheckImageResourceUrl
1100             {
1101                 get
1102                 {
1103                     return itemDataStyle.CheckImage?.ResourceUrl?.All;
1104                 }
1105                 set
1106                 {
1107                     if (null == itemDataStyle.CheckImage.ResourceUrl)
1108                     {
1109                         itemDataStyle.CheckImage.ResourceUrl = new Selector<string> { All = value };
1110                     }
1111                     else
1112                     {
1113                         itemDataStyle.CheckImage.ResourceUrl = value;
1114                     }
1115                 }
1116             }
1117
1118             /// <summary>
1119             /// DropDown item's check image's size.
1120             /// </summary>
1121             /// <since_tizen> 6 </since_tizen>
1122             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1123             [EditorBrowsable(EditorBrowsableState.Never)]
1124             public Size CheckImageSize
1125             {
1126                 get
1127                 {
1128                     return itemDataStyle.CheckImage?.Size;
1129                 }
1130                 set
1131                 {
1132                     itemDataStyle.CheckImage.Size = value;
1133                 }
1134             }
1135
1136             /// <summary>
1137             /// DropDown item's check image's right space.
1138             /// </summary>
1139             /// <since_tizen> 6 </since_tizen>
1140             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1141             [EditorBrowsable(EditorBrowsableState.Never)]
1142             public int CheckImageGapToBoundary
1143             {
1144                 get
1145                 {
1146                     return itemDataStyle.CheckImageGapToBoundary;
1147                 }
1148                 set
1149                 {
1150                     itemDataStyle.CheckImageGapToBoundary = value;
1151                 }
1152             }
1153
1154             /// <summary>
1155             /// Flag to decide DropDown item is selected or not.
1156             /// </summary>
1157             /// <since_tizen> 6 </since_tizen>
1158             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1159             [EditorBrowsable(EditorBrowsableState.Never)]
1160             public bool IsSelected
1161             {
1162                 get
1163                 {
1164                     return itemDataStyle.IsSelected;
1165                 }
1166                 set
1167                 {
1168                     itemDataStyle.IsSelected = value;
1169                 }
1170             }
1171
1172             private void Initialize()
1173             {
1174                 if (itemDataStyle == null)
1175                 {
1176                     throw new Exception("DropDownDataItem style parse error.");
1177                 }
1178             }
1179         }
1180         #endregion
1181
1182         #region DropDownItemView
1183         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1184         [EditorBrowsable(EditorBrowsableState.Never)]
1185         internal class DropDownItemView : Control
1186         {
1187             private TextLabel mText = null;
1188             private ImageView mIcon = null;
1189             private ImageView mCheck = null;
1190
1191             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1192             [EditorBrowsable(EditorBrowsableState.Never)]
1193             public DropDownItemView() : base() { }
1194
1195             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1196             [EditorBrowsable(EditorBrowsableState.Never)]
1197             public Selector<Color> BackgroundColorSelector { get; set; }
1198
1199             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1200             [EditorBrowsable(EditorBrowsableState.Never)]
1201             public string Text
1202             {
1203                 get
1204                 {
1205                     return (null == mText) ? null : mText.Text;
1206                 }
1207                 set
1208                 {
1209                     CreateText();
1210                     mText.Text = value;
1211                 }
1212             }
1213
1214             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1215             [EditorBrowsable(EditorBrowsableState.Never)]
1216             public string FontFamily
1217             {
1218                 get
1219                 {
1220                     return (null == mText) ? null : mText.FontFamily;
1221                 }
1222                 set
1223                 {
1224                     CreateText();
1225                     mText.FontFamily = value;
1226                 }
1227             }
1228
1229             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1230             [EditorBrowsable(EditorBrowsableState.Never)]
1231             public float? PointSize
1232             {
1233                 get
1234                 {
1235                     return (null == mText) ? 0 : mText.PointSize;
1236                 }
1237                 set
1238                 {
1239                     CreateText();
1240                     mText.PointSize = (float)value;
1241                 }
1242             }
1243
1244             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1245             [EditorBrowsable(EditorBrowsableState.Never)]
1246             public Color TextColor
1247             {
1248                 get
1249                 {
1250                     return (null == mText) ? null : mText.TextColor;
1251                 }
1252                 set
1253                 {
1254                     CreateText();
1255                     mText.TextColor = value;
1256                 }
1257             }
1258
1259             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1260             [EditorBrowsable(EditorBrowsableState.Never)]
1261             public Position TextPosition
1262             {
1263                 get
1264                 {
1265                     return (null == mText) ? null : mText.Position;
1266                 }
1267                 set
1268                 {
1269                     CreateText();
1270                     mText.Position = value;
1271                 }
1272             }
1273
1274             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1275             [EditorBrowsable(EditorBrowsableState.Never)]
1276             public string IconResourceUrl
1277             {
1278                 get
1279                 {
1280                     return (null == mIcon) ? null : mIcon.ResourceUrl;
1281                 }
1282                 set
1283                 {
1284                     CreateIcon();
1285                     mIcon.ResourceUrl = value;
1286                 }
1287             }
1288
1289             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1290             [EditorBrowsable(EditorBrowsableState.Never)]
1291             public Size IconSize
1292             {
1293                 get
1294                 {
1295                     return (null == mIcon) ? null : mIcon.Size;
1296                 }
1297                 set
1298                 {
1299                     CreateIcon();
1300                     mIcon.Size = value;
1301                 }
1302             }
1303
1304             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1305             [EditorBrowsable(EditorBrowsableState.Never)]
1306             public Position IconPosition
1307             {
1308                 get
1309                 {
1310                     return (null == mIcon) ? null : mIcon.Position;
1311                 }
1312                 set
1313                 {
1314                     CreateIcon();
1315                     mIcon.Position = value;
1316                 }
1317             }
1318
1319             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1320             [EditorBrowsable(EditorBrowsableState.Never)]
1321             public string CheckResourceUrl
1322             {
1323                 get
1324                 {
1325                     return (null == mCheck) ? null : mCheck.ResourceUrl;
1326                 }
1327                 set
1328                 {
1329                     CreateCheckImage();
1330                     mCheck.ResourceUrl = value;
1331                 }
1332             }
1333
1334             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1335             [EditorBrowsable(EditorBrowsableState.Never)]
1336             public Position CheckPosition
1337             {
1338                 get
1339                 {
1340                     return (null == mCheck) ? null : mCheck.Position;
1341                 }
1342                 set
1343                 {
1344                     CreateCheckImage();
1345                     mCheck.Position = value;
1346                 }
1347             }
1348
1349             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1350             [EditorBrowsable(EditorBrowsableState.Never)]
1351             public Size CheckImageSize
1352             {
1353                 get
1354                 {
1355                     return (null == mCheck) ? null : mCheck.Size;
1356                 }
1357                 set
1358                 {
1359                     CreateCheckImage();
1360                     mCheck.Size = value;
1361                 }
1362             }
1363
1364             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1365             [EditorBrowsable(EditorBrowsableState.Never)]
1366             public bool IsSelected
1367             {
1368                 get
1369                 {
1370                     return (null == mCheck) ? false : mCheck.Visibility;
1371                 }
1372                 set
1373                 {
1374                     CreateCheckImage();
1375                     if(value)
1376                     {
1377                         mCheck.Show();
1378                     }
1379                     else
1380                     {
1381                         mCheck.Hide();
1382                     }
1383                 }
1384             }
1385
1386             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1387             [EditorBrowsable(EditorBrowsableState.Never)]
1388             protected override void Dispose(DisposeTypes type)
1389             {
1390                 if (disposed)
1391                 {
1392                     return;
1393                 }
1394
1395                 if (type == DisposeTypes.Explicit)
1396                 {
1397                     if (mText != null)
1398                     {
1399                         Remove(mText);
1400                         mText.Dispose();
1401                         mText = null;
1402                     }
1403
1404                     if (mIcon != null)
1405                     {
1406                         Remove(mIcon);
1407                         mIcon.Dispose();
1408                         mIcon = null;
1409                     }
1410
1411                     if (mCheck != null)
1412                     {
1413                         Remove(mCheck);
1414                         mCheck.Dispose();
1415                         mCheck = null;
1416                     }
1417                 }
1418                 base.Dispose(type);
1419             }
1420
1421             /// <summary>
1422             /// Get DropDownItemView style.
1423             /// </summary>
1424             /// <returns>The empty.</returns>
1425             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1426             [EditorBrowsable(EditorBrowsableState.Never)]
1427             protected override ViewStyle CreateViewStyle()
1428             {
1429                 return new DropDownItemStyle();
1430             }
1431
1432             private void CreateIcon()
1433             {
1434                 if(mIcon == null)
1435                 {
1436                     mIcon = new ImageView()
1437                     {
1438                         PositionUsesPivotPoint = true,
1439                         ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1440                         PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1441                     };
1442                     Add(mIcon);
1443                 }
1444             }
1445
1446             private void CreateText()
1447             {
1448                 if (mText == null)
1449                 {
1450                     mText = new TextLabel()
1451                     {
1452                         PositionUsesPivotPoint = true,
1453                         ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1454                         PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1455                         WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1456                         HeightResizePolicy = ResizePolicyType.FillToParent,
1457                         VerticalAlignment = VerticalAlignment.Center,
1458                         HorizontalAlignment = HorizontalAlignment.Begin,
1459                     };
1460                     Add(mText);
1461                 }
1462             }
1463
1464             private void CreateCheckImage()
1465             {
1466                 if (mCheck == null)
1467                 {
1468                     mCheck = new ImageView()
1469                     {
1470                         PositionUsesPivotPoint = true,
1471                         ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1472                         PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1473                         Name = "checkedImage",
1474                     };
1475                     Add(mCheck);
1476                 }
1477                 mCheck.Hide();
1478             }
1479         }
1480         #endregion
1481
1482         #region DropDownListBridge
1483
1484         /// <summary>
1485         /// DropDownListBridge is bridge to connect item data and an item View.
1486         /// </summary>
1487         /// <since_tizen> 6 </since_tizen>
1488         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1489         [EditorBrowsable(EditorBrowsableState.Never)]
1490         public class DropDownListBridge
1491         {
1492             private List<DropDownDataItem> itemDataList = new List<DropDownDataItem>();
1493
1494             internal bool AdapterPurge {get;set;} = false;  // Set to true if adapter content changed since last iteration.
1495
1496             /// <summary>
1497             /// Creates a new instance of a DropDownListBridge.
1498             /// </summary>
1499             /// <since_tizen> 6 </since_tizen>
1500             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1501             [EditorBrowsable(EditorBrowsableState.Never)]
1502             public DropDownListBridge() { }
1503
1504             /// <summary>
1505             /// Insert data. The inserted data will be added to the special position by index automatically.
1506             /// </summary>
1507             /// <param name="position">Position index where will be inserted.</param>
1508             /// <param name="data">Item data which will apply to tab item view.</param>
1509             /// <since_tizen> 6 </since_tizen>
1510             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1511             [EditorBrowsable(EditorBrowsableState.Never)]
1512             public void InsertData(int position, DropDownDataItem data)
1513             {
1514                 if(position == -1)
1515                 {
1516                     position = itemDataList.Count;
1517                 }
1518                 itemDataList.Insert(position, data);
1519                 AdapterPurge = true;
1520             }
1521
1522             /// <summary>
1523             /// Remove data by position.
1524             /// </summary>
1525             /// <param name="position">Position index where will be removed.</param>
1526             /// <since_tizen> 6 </since_tizen>
1527             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1528             [EditorBrowsable(EditorBrowsableState.Never)]
1529             public void RemoveData(int position)
1530             {
1531                 itemDataList.RemoveAt(position);
1532                 AdapterPurge = true;
1533             }
1534
1535             /// <summary>
1536             /// Get data by position.
1537             /// </summary>
1538             /// <param name="position">Position index where will be gotten.</param>
1539             /// <since_tizen> 6 </since_tizen>
1540             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1541             [EditorBrowsable(EditorBrowsableState.Never)]
1542             public DropDownDataItem GetData(int position)
1543             {
1544                 return itemDataList[position];
1545             }
1546
1547             /// <summary>
1548             /// Get view holder by view type.
1549             /// </summary>
1550             /// <since_tizen> 6 </since_tizen>
1551             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1552             [EditorBrowsable(EditorBrowsableState.Never)]
1553             public ViewHolder OnCreateViewHolder()
1554             {
1555                 ViewHolder viewHolder = new ViewHolder(new DropDownItemView());
1556
1557                 return viewHolder;
1558             }
1559
1560             /// <summary>
1561             /// Bind ViewHolder with View.
1562             /// </summary>
1563             /// <param name="holder">View holder.</param>
1564             /// <param name="position">Position index of source data.</param>
1565             /// <since_tizen> 6 </since_tizen>
1566             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1567             [EditorBrowsable(EditorBrowsableState.Never)]
1568             public void BindViewHolder(ViewHolder holder, int position)
1569             {
1570                 if (null == holder) return;
1571                 DropDownDataItem listItemData = itemDataList[position];
1572                 if(listItemData == null)
1573                 {
1574                     return;
1575                 }
1576                 DropDownItemView listItemView = holder.ItemView as DropDownItemView;
1577                 listItemView.Name = "Item" + position;
1578                 if (listItemData.Size != null)
1579                 {
1580                     if (listItemData.Size.Width > 0)
1581                     {
1582                         holder.ItemView.WidthSpecification = (int)listItemData.Size.Width;
1583                     }
1584                     else
1585                     {
1586                         holder.ItemView.WidthSpecification = LayoutParamPolicies.MatchParent;
1587                     }
1588
1589                     if (listItemData.Size.Height > 0)
1590                     {
1591                         holder.ItemView.HeightSpecification = (int)listItemData.Size.Height;
1592                     }
1593                     else
1594                     {
1595                         holder.ItemView.HeightSpecification = LayoutParamPolicies.MatchParent;
1596                     }
1597                 }
1598
1599                 if (listItemView != null)
1600                 {
1601                     listItemView.BackgroundColorSelector = listItemData.BackgroundColor;
1602                     if (listItemData.Text != null)
1603                     {
1604                         listItemView.Text = listItemData.Text;
1605                         listItemView.PointSize = listItemData.PointSize;
1606                         listItemView.FontFamily = listItemData.FontFamily;
1607                         listItemView.TextPosition = listItemData.TextPosition;
1608                     }
1609
1610                     if (listItemData.IconResourceUrl != null)
1611                     {
1612                         listItemView.IconResourceUrl = listItemData.IconResourceUrl;
1613                         listItemView.IconSize = listItemData.IconSize;
1614                         if (listItemView.IconSize != null)
1615                         {
1616                             listItemView.IconPosition = new Position(listItemData.IconPosition.X, (listItemView.Size2D.Height - listItemView.IconSize.Height) / 2);
1617                         }
1618                     }
1619
1620                     if (listItemData.CheckImageResourceUrl != null)
1621                     {
1622                         listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
1623
1624                         if (null != listItemData.CheckImageSize)
1625                         {
1626                             listItemView.CheckImageSize = listItemData.CheckImageSize;
1627                         }
1628
1629                         if (listItemView.CheckImageSize != null)
1630                         {
1631                             listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageGapToBoundary - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2);
1632                         }
1633                     }
1634
1635                     listItemView.IsSelected = listItemData.IsSelected;
1636                 }
1637             }
1638
1639             /// <summary>
1640             /// Destroy view holder, it can be override.
1641             /// </summary>
1642             /// <param name="holder">View holder.</param>
1643             /// <since_tizen> 6 </since_tizen>
1644             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1645             [EditorBrowsable(EditorBrowsableState.Never)]
1646             public void OnDestroyViewHolder(ViewHolder holder)
1647             {
1648                 if (null == holder) return;
1649                 if (holder.ItemView != null)
1650                 {
1651                     holder.ItemView.Dispose();
1652                 }
1653             }
1654
1655             /// <summary>
1656             /// Get item count, it can be override.
1657             /// </summary>
1658             /// <since_tizen> 6 </since_tizen>
1659             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1660             [EditorBrowsable(EditorBrowsableState.Never)]
1661             public int GetItemCount()
1662             {
1663                 return itemDataList.Count;
1664             }
1665         }
1666
1667         #endregion
1668
1669         #region ViewHolder
1670
1671         /// <summary>
1672         /// A ViewHolder is a class that holds a View created from DropDownListBridge data.
1673         /// </summary>
1674         /// <since_tizen> 6 </since_tizen>
1675         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1676         [EditorBrowsable(EditorBrowsableState.Never)]
1677         public class ViewHolder
1678         {
1679             /// <summary>
1680             /// ViewHolder constructor.
1681             /// </summary>
1682             /// <param name="itemView">View</param>
1683             /// <since_tizen> 6 </since_tizen>
1684             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1685             [EditorBrowsable(EditorBrowsableState.Never)]
1686             public ViewHolder(View itemView)
1687             {
1688                 if (itemView == null)
1689                 {
1690                     throw new ArgumentNullException("itemView may not be null");
1691                 }
1692                 this.ItemView = itemView;
1693             }
1694
1695             /// <summary>
1696             /// Returns the view.
1697             /// </summary>
1698             /// <since_tizen> 6 </since_tizen>
1699             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1700             [EditorBrowsable(EditorBrowsableState.Never)]
1701             public View ItemView { get; }
1702
1703             internal bool IsBound { get; set; }
1704         }
1705
1706         #endregion
1707     }
1708 }