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