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