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