2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
22 namespace Tizen.NUI.Components
25 /// DropDown is one kind of common component, a dropdown allows the user click dropdown button to choose one value from a list.
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
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;
43 private Extents listMargin = null;
44 private Extents listPadding = null;
47 /// Creates a new instance of a DropDown.
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()
57 /// Creates a new instance of a DropDown with style.
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)
68 /// Creates a new instance of a DropDown with attributes.
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)
80 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
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);
88 /// An event for the item clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
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;
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
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)]
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)]
120 /// Header text string in DropDown.
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
129 return dropDownAttributes.HeaderTextAttributes?.Text.All;
135 CreateHeaderTextAttributes();
136 if (dropDownAttributes.HeaderTextAttributes.Text == null)
138 dropDownAttributes.HeaderTextAttributes.Text = new StringSelector();
140 dropDownAttributes.HeaderTextAttributes.Text.All = value;
147 /// Header text point size in DropDown.
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
156 return dropDownAttributes.HeaderTextAttributes?.PointSize?.All ?? 0;
160 CreateHeaderTextAttributes();
161 if (dropDownAttributes.HeaderTextAttributes.PointSize == null)
163 dropDownAttributes.HeaderTextAttributes.PointSize = new FloatSelector();
165 dropDownAttributes.HeaderTextAttributes.PointSize.All = value;
171 /// Header text font family in DropDown.
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
180 return dropDownAttributes.HeaderTextAttributes?.FontFamily;
184 CreateHeaderTextAttributes();
185 dropDownAttributes.HeaderTextAttributes.FontFamily = value;
191 /// Header text color in DropDown.
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
200 return dropDownAttributes.HeaderTextAttributes?.TextColor?.All;
204 CreateHeaderTextAttributes();
205 if (dropDownAttributes.HeaderTextAttributes.TextColor == null)
207 dropDownAttributes.HeaderTextAttributes.TextColor = new ColorSelector();
209 dropDownAttributes.HeaderTextAttributes.TextColor.All = value;
215 /// Header text color selector in DropDown.
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
224 return dropDownAttributes.HeaderTextAttributes?.TextColor;
228 CreateHeaderTextAttributes();
231 dropDownAttributes.HeaderTextAttributes.TextColor = value.Clone() as ColorSelector;
238 /// Button text string in DropDown.
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
247 return dropDownAttributes.ButtonAttributes?.TextAttributes?.Text.All;
253 CreateButtonTextAttributes();
254 if (dropDownAttributes.ButtonAttributes.TextAttributes.Text == null)
256 dropDownAttributes.ButtonAttributes.TextAttributes.Text = new StringSelector();
258 dropDownAttributes.ButtonAttributes.TextAttributes.Text.All = value;
265 /// Button text point size in DropDown.
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
274 return dropDownAttributes.ButtonAttributes?.TextAttributes?.PointSize?.All ?? 0;
278 CreateButtonTextAttributes();
279 if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize == null)
281 dropDownAttributes.ButtonAttributes.TextAttributes.PointSize = new FloatSelector();
283 dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All = value;
289 /// Button text font family in DropDown.
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
298 return dropDownAttributes.ButtonAttributes?.TextAttributes?.FontFamily;
302 CreateButtonTextAttributes();
303 dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily = value;
309 /// Button text color in DropDown.
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
318 return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor?.All;
322 CreateButtonTextAttributes();
323 if (dropDownAttributes.ButtonAttributes.TextAttributes.TextColor == null)
325 dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = new ColorSelector();
327 dropDownAttributes.ButtonAttributes.TextAttributes.TextColor.All = value;
333 /// Button text color selector in DropDown.
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
342 return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor;
346 CreateButtonTextAttributes();
349 dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector;
356 /// Button icon image's resource url in DropDown.
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
365 return dropDownAttributes.ButtonAttributes?.IconAttributes?.ResourceURL.All;
371 CreateButtonIconAttributes();
372 if (dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL == null)
374 dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL = new StringSelector();
376 dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL.All = value;
383 /// Button icon image's size in DropDown.
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
392 return dropDownAttributes.ButtonAttributes?.IconAttributes?.Size;
398 CreateButtonIconAttributes();
399 dropDownAttributes.ButtonAttributes.IconAttributes.Size = value;
406 /// Space between button text and button icon in DropDown.
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
415 return dropDownAttributes.SpaceBetweenButtonTextAndIcon;
419 dropDownAttributes.SpaceBetweenButtonTextAndIcon = value;
425 /// Left space in DropDown.
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)]
434 return (int)dropDownAttributes.Space.X;
438 dropDownAttributes.Space.X = value;
444 /// Right space in DropDown.
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
453 return (int)dropDownAttributes.Space.Y;
457 dropDownAttributes.Space.Y = value;
463 /// List background image's resource url in DropDown.
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
472 return dropDownAttributes.ListBackgroundImageAttributes?.ResourceURL?.All;
478 CreateListBackgroundAttributes();
479 if (dropDownAttributes.ListBackgroundImageAttributes.ResourceURL == null)
481 dropDownAttributes.ListBackgroundImageAttributes.ResourceURL = new StringSelector();
483 dropDownAttributes.ListBackgroundImageAttributes.ResourceURL.All = value;
490 /// List background image's border in DropDown.
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
499 return dropDownAttributes.ListBackgroundImageAttributes?.Border?.All;
505 CreateListBackgroundAttributes();
506 if (dropDownAttributes.ListBackgroundImageAttributes.Border == null)
508 dropDownAttributes.ListBackgroundImageAttributes.Border = new RectangleSelector();
510 dropDownAttributes.ListBackgroundImageAttributes.Border.All = value;
517 /// List relative orientation in DropDown.
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
526 return dropDownAttributes.ListRelativeOrientation;
530 dropDownAttributes.ListRelativeOrientation = value;
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
549 dropDownAttributes.ListMargin.CopyFrom(value);
551 if (null == listMargin)
553 listMargin = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
555 dropDownAttributes.ListMargin.Start = start;
556 dropDownAttributes.ListMargin.End = end;
557 dropDownAttributes.ListMargin.Top = top;
558 dropDownAttributes.ListMargin.Bottom = bottom;
560 }, value.Start, value.End, value.Top, value.Bottom);
564 listMargin.CopyFrom(value);
572 /// Focused item index in list.
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
581 return dropDownAttributes.FocusedItemIndex;
585 dropDownAttributes.FocusedItemIndex = value;
591 /// Selected item index in list.
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
600 return selectedItemIndex;
604 if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount())
608 UpdateSelectedItem(value);
613 /// List size in DropDown.
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)]
622 return dropDownAttributes.ListSize;
626 dropDownAttributes.ListSize = value;
632 /// List padding in DropDown.
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
645 if (dropDownAttributes.ListPadding == null)
647 dropDownAttributes.ListPadding = new Extents();
649 dropDownAttributes.ListPadding.CopyFrom(value);
651 if (null == listPadding)
653 listPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
655 dropDownAttributes.ListPadding.Start = start;
656 dropDownAttributes.ListPadding.End = end;
657 dropDownAttributes.ListPadding.Top = top;
658 dropDownAttributes.ListPadding.Bottom = bottom;
660 }, value.Start, value.End, value.Top, value.Bottom);
664 listMargin.CopyFrom(value);
672 /// Add list item by item data. The added item will be added to end of all items automatically.
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)
680 adapter.InsertData(-1, itemData);
684 /// Delete list item by index.
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)
692 if(index < 0 || index >= adapter.GetItemCount())
697 if (selectedItemIndex == index)
699 selectedItemIndex = -1;
701 else if(selectedItemIndex > index)
706 adapter.RemoveData(index);
710 /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
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)
719 if (index < 0 || index >= adapter.GetItemCount())
724 if (selectedItemIndex >= index)
729 adapter.InsertData(index, item);
733 /// Add scroll bar to list.
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)
745 list.AttachScrollBar(scrollBar);
749 /// Detach scroll bar to list.
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()
760 list.DetachScrollBar();
764 /// Update DropDown by attributes.
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()
771 if (dropDownAttributes.HeaderTextAttributes != null)
773 if (headerText == null)
777 ApplyAttributes(headerText, dropDownAttributes.HeaderTextAttributes);
781 if (dropDownAttributes.ButtonAttributes != null)
787 if (dropDownAttributes.Space != null)
789 button.Position2D.X = (int)dropDownAttributes.Space.X;
792 if (dropDownAttributes.ButtonAttributes.TextAttributes != null)
794 ApplyAttributes(buttonText, dropDownAttributes.ButtonAttributes.TextAttributes);
795 button.TextSelector = dropDownAttributes.ButtonAttributes.TextAttributes.Text;
796 if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize != null)
798 button.PointSize = dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All.Value;
800 button.FontFamily = dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily;
801 button.TextColorSelector = dropDownAttributes.ButtonAttributes.TextAttributes.TextColor;
803 if (dropDownAttributes.ButtonAttributes.IconAttributes != null)
805 button.IconURLSelector = dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL;
807 int buttonTextWidth = 0;
808 if (dropDownAttributes.ButtonAttributes.IconAttributes.Size != null)
810 iconWidth = (int)dropDownAttributes.ButtonAttributes.IconAttributes.Size.Width;
812 if (buttonText.NaturalSize2D != null)
814 buttonTextWidth = buttonText.NaturalSize2D.Width;
816 button.SizeWidth = iconWidth + dropDownAttributes.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
820 if (dropDownAttributes.ListBackgroundImageAttributes != null)
822 if (listBackgroundImage == null)
824 CreateListBackgroundImage();
827 ApplyAttributes(listBackgroundImage, dropDownAttributes.ListBackgroundImageAttributes);
828 list.FocusedItemIndex = dropDownAttributes.FocusedItemIndex;
829 list.Size = dropDownAttributes.ListSize;
830 list.Padding = dropDownAttributes.ListPadding;
832 int listBackgroundImageX = 0;
833 int listBackgroundImageY = 0;
834 if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Left)
836 if (dropDownAttributes.ListMargin != null)
838 listBackgroundImageX = (int)dropDownAttributes.ListMargin.Start;
839 listBackgroundImageY = (int)dropDownAttributes.ListMargin.Top;
842 else if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Right)
844 if (dropDownAttributes.ListMargin != null)
847 if (list.Size2D != null)
849 listWidth = list.Size2D.Width;
851 listBackgroundImageX = Size2D.Width - listWidth - (int)dropDownAttributes.ListMargin.End;
852 listBackgroundImageY = (int)dropDownAttributes.ListMargin.Top;
855 listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
860 /// Dispose DropDown and all children on it.
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)
873 if (type == DisposeTypes.Explicit)
875 if (headerText != null)
877 Utility.Dispose(headerText);
880 if (buttonText != null)
882 Utility.Dispose(buttonText);
887 Utility.Dispose(button);
892 if (listBackgroundImage != null)
894 Utility.Dispose(listBackgroundImage);
897 Utility.Dispose(list);
905 /// Get DropDown attribues.
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()
912 return new DropDownAttributes();
915 private void Initialize()
917 dropDownAttributes = attributes as DropDownAttributes;
918 if (dropDownAttributes == null)
920 throw new Exception("DropDown attribute parse error.");
922 ApplyAttributes(this, dropDownAttributes);
925 private void OnClickEvent(object sender, ItemClickEventArgs e)
927 ItemClickEvent?.Invoke(sender, e);
930 private void CreateHeaderText()
932 headerText = new TextLabel();
933 headerText.Name = "DropDownHeaderText";
937 private void CreateButton()
939 button = new Button()
941 PositionUsesPivotPoint = true,
942 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
943 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
944 HeightResizePolicy = ResizePolicyType.FillToParent,
945 IconRelativeOrientation = Button.IconOrientation.Right,
947 button.Name = "DropDownButton";
948 button.ClickEvent += ButtonClickEvent;
951 buttonText = new TextLabel()
953 PositionUsesPivotPoint = true,
954 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
955 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
956 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
957 HeightResizePolicy = ResizePolicyType.FillToParent,
959 buttonText.Name = "DropDownButtonText";
964 private void CreateList()
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();
978 private void ListItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e)
980 if (e.ClickedView != null)
982 UpdateSelectedItem(e.ClickedView.AdapterPosition);
984 ItemClickEventArgs args = new ItemClickEventArgs();
985 args.Index = e.ClickedView.AdapterPosition;
986 args.Text = (e.ClickedView.ItemView as DropDownItemView)?.Text;
987 OnClickEvent(this, args);
990 listBackgroundImage.Hide();
993 private void ListItemTouchEvent(object sender, FlexibleView.ItemTouchEventArgs e)
995 PointStateType state = e.Touch.GetState(0);
998 case PointStateType.Down:
999 if (e.TouchedView != null)
1001 touchedView = e.TouchedView.ItemView as DropDownItemView;
1002 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1004 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
1008 case PointStateType.Motion:
1009 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1011 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
1014 case PointStateType.Up:
1015 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1017 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
1025 private void UpdateSelectedItem(int index)
1027 if (selectedItemIndex != -1)
1029 DropDownItemData data = adapter.GetData(selectedItemIndex);
1032 data.IsSelected = false;
1034 DropDownItemView view = list?.FindViewHolderForAdapterPosition(selectedItemIndex)?.ItemView as DropDownItemView;
1037 view.IsSelected = false;
1043 DropDownItemData data = adapter.GetData(index);
1046 data.IsSelected = true;
1048 DropDownItemView view = list?.FindViewHolderForAdapterPosition(index)?.ItemView as DropDownItemView;
1051 view.IsSelected = true;
1052 button.Text = view.Text;
1056 selectedItemIndex = index;
1059 private void CreateListBackgroundImage()
1061 listBackgroundImage = new ImageView
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,
1070 Add(listBackgroundImage);
1073 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
1075 listBackgroundImage.Show();
1078 private void CreateHeaderTextAttributes()
1080 if (dropDownAttributes.HeaderTextAttributes == null)
1082 dropDownAttributes.HeaderTextAttributes = new TextAttributes()
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,
1095 private void CreateButtonAttributes()
1097 if (dropDownAttributes.ButtonAttributes == null)
1099 dropDownAttributes.ButtonAttributes = new ButtonAttributes();
1103 private void CreateButtonTextAttributes()
1105 CreateButtonAttributes();
1107 if (dropDownAttributes.ButtonAttributes.TextAttributes == null)
1109 dropDownAttributes.ButtonAttributes.TextAttributes = new TextAttributes
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,
1123 private void CreateButtonIconAttributes()
1125 CreateButtonAttributes();
1127 if (dropDownAttributes.ButtonAttributes.IconAttributes == null)
1129 dropDownAttributes.ButtonAttributes.IconAttributes = new ImageAttributes
1131 PositionUsesPivotPoint = true,
1132 ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight,
1133 PivotPoint = Tizen.NUI.PivotPoint.CenterRight,
1138 private void CreateListBackgroundAttributes()
1140 if (dropDownAttributes.ListBackgroundImageAttributes == null)
1142 dropDownAttributes.ListBackgroundImageAttributes = new ImageAttributes
1144 PositionUsesPivotPoint = true,
1145 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1146 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1152 #region ItemClickEventArgs
1154 /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
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
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)]
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)]
1174 #region DropDownItemData
1176 /// DropDownItemData is a class to record all data which will be applied to DropDown item.
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
1183 private DropDownItemAttributes itemDataAttributes = new DropDownItemAttributes();
1186 /// Creates a new instance of a DropDownItemData.
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()
1197 /// Creates a new instance of a DropDownItemData with style.
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)
1207 Attributes attributes = StyleManager.Instance.GetAttributes(style);
1208 if(attributes == null)
1210 throw new InvalidOperationException($"There is no style {style}");
1212 itemDataAttributes = attributes as DropDownItemAttributes;
1218 /// Creates a new instance of a DropDownItemData with attributes.
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)
1226 itemDataAttributes = attributes.Clone() as DropDownItemAttributes;
1231 /// DropDown item size.
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)]
1240 return itemDataAttributes.Size;
1244 itemDataAttributes.Size = value;
1249 /// DropDown item background color selector.
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
1258 return itemDataAttributes.BackgroundColor;
1262 if (itemDataAttributes.BackgroundColor == null)
1264 itemDataAttributes.BackgroundColor = value.Clone() as ColorSelector;
1268 itemDataAttributes.BackgroundColor = value.Clone();
1275 /// DropDown item text string.
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)]
1284 return itemDataAttributes.TextAttributes?.Text?.All;
1288 CreateTextAttributes();
1289 if (itemDataAttributes.TextAttributes.Text == null)
1291 itemDataAttributes.TextAttributes.Text = new StringSelector { All = value };
1295 itemDataAttributes.TextAttributes.Text.All = value;
1301 /// DropDown item text's point size.
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
1310 return itemDataAttributes.TextAttributes?.PointSize?.All ?? 0;
1314 CreateTextAttributes();
1315 if (itemDataAttributes.TextAttributes.PointSize == null)
1317 itemDataAttributes.TextAttributes.PointSize = new FloatSelector { All = value };
1321 itemDataAttributes.TextAttributes.PointSize.All = value;
1327 /// DropDown item text's font family.
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
1336 return itemDataAttributes.TextAttributes?.FontFamily;
1340 CreateTextAttributes();
1341 itemDataAttributes.TextAttributes.FontFamily = value;
1346 /// DropDown item text's position.
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
1355 return itemDataAttributes.TextAttributes?.Position;
1359 CreateTextAttributes();
1360 itemDataAttributes.TextAttributes.Position = value;
1365 /// DropDown item's icon's resource url.
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
1374 return itemDataAttributes.IconAttributes?.ResourceURL?.All;
1378 CreateIconAttributes();
1379 if (itemDataAttributes.IconAttributes.ResourceURL == null)
1381 itemDataAttributes.IconAttributes.ResourceURL = new StringSelector { All = value };
1385 itemDataAttributes.IconAttributes.ResourceURL.All = value;
1391 /// DropDown item's icon's size.
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
1400 return itemDataAttributes.IconAttributes?.Size;
1404 CreateIconAttributes();
1405 itemDataAttributes.IconAttributes.Size = value;
1410 /// DropDown item's icon's position.
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
1419 return itemDataAttributes.IconAttributes.Position;
1423 CreateIconAttributes();
1424 itemDataAttributes.IconAttributes.Position = value;
1429 /// DropDown item's check image's resource url.
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
1438 return itemDataAttributes.CheckImageAttributes?.ResourceURL?.All;
1442 CreateCheckImageAttributes();
1443 if (itemDataAttributes.CheckImageAttributes.ResourceURL == null)
1445 itemDataAttributes.CheckImageAttributes.ResourceURL = new StringSelector { All = value };
1449 itemDataAttributes.CheckImageAttributes.ResourceURL.All = value;
1455 /// DropDown item's check image's size.
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
1464 return itemDataAttributes.CheckImageAttributes?.Size;
1468 CreateCheckImageAttributes();
1469 itemDataAttributes.CheckImageAttributes.Size = value;
1474 /// DropDown item's check image's right space.
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
1483 return itemDataAttributes.CheckImageGapToBoundary;
1487 itemDataAttributes.CheckImageGapToBoundary = value;
1492 /// Flag to decide DropDown item is selected or not.
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
1501 return itemDataAttributes.IsSelected;
1505 itemDataAttributes.IsSelected = value;
1509 private void Initalize()
1511 if (itemDataAttributes == null)
1513 throw new Exception("Button attribute parse error.");
1517 private void CreateTextAttributes()
1519 if(itemDataAttributes.TextAttributes == null)
1521 itemDataAttributes.TextAttributes = new TextAttributes
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,
1534 private void CreateIconAttributes()
1536 if (itemDataAttributes.IconAttributes == null)
1538 itemDataAttributes.IconAttributes = new ImageAttributes
1540 PositionUsesPivotPoint = true,
1541 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1542 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1547 private void CreateCheckImageAttributes()
1549 if (itemDataAttributes.CheckImageAttributes == null)
1551 itemDataAttributes.CheckImageAttributes = new ImageAttributes
1553 PositionUsesPivotPoint = true,
1554 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1555 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
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
1567 private TextLabel mText = null;
1568 private ImageView mIcon = null;
1569 private ImageView mCheck = null;
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()
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
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)]
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
1614 return mText.FontFamily;
1619 mText.FontFamily = value;
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
1633 return mText.PointSize;
1638 mText.PointSize = value;
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
1652 return mText.TextColor;
1657 mText.TextColor = value;
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
1671 return mText.Position;
1676 mText.Position = value;
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
1690 return mIcon.ResourceUrl;
1695 mIcon.ResourceUrl = value;
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
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
1728 return mIcon.Position;
1733 mIcon.Position = value;
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
1747 return mCheck.ResourceUrl;
1752 mCheck.ResourceUrl = value;
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
1766 return mCheck.Position;
1771 mCheck.Position = value;
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
1790 mCheck.Size = value;
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
1804 return mCheck.Visibility;
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)
1829 if (type == DisposeTypes.Explicit)
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()
1862 private void CreateIcon()
1866 mIcon = new ImageView()
1868 PositionUsesPivotPoint = true,
1869 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1870 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1876 private void CreateText()
1880 mText = new TextLabel()
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,
1894 private void CreateCheckImage()
1898 mCheck = new ImageView()
1900 PositionUsesPivotPoint = true,
1901 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1902 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1911 #region DropDownListBridge
1914 /// DropDownListBridge is bridge to contact item data and item view.
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
1921 private List<DropDownItemData> mDatas = new List<DropDownItemData>();
1924 /// Creates a new instance of a DropDownListBridge.
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()
1934 /// Insert data. The inserted data will be added to the special position by index automatically.
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)
1945 position = mDatas.Count;
1947 mDatas.Insert(position, data);
1948 NotifyItemInserted(position);
1952 /// Remove data by position.
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)
1960 mDatas.RemoveAt(position);
1961 NotifyItemRemoved(position);
1965 /// Get data by position.
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)
1973 return mDatas[position];
1977 /// Get view holder by view type.
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)
1985 FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new DropDownItemView());
1991 /// Binder view holder, it can be override.
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)
2000 DropDownItemData listItemData = mDatas[position];
2001 if(listItemData == null)
2005 DropDownItemView listItemView = holder.ItemView as DropDownItemView;
2006 listItemView.Name = "Item" + position;
2007 if (listItemData.Size != null)
2009 holder.ItemView.Size = listItemData.Size;
2012 if (listItemView != null)
2014 listItemView.BackgroundColorSelector = listItemData.BackgroundColorSelector;
2015 if (listItemData.Text != null)
2017 listItemView.Text = listItemData.Text;
2018 listItemView.PointSize = listItemData.PointSize;
2019 listItemView.FontFamily = listItemData.FontFamily;
2020 listItemView.TextPosition = listItemData.TextPosition;
2023 if (listItemData.IconResourceUrl != null)
2025 listItemView.IconResourceUrl = listItemData.IconResourceUrl;
2026 listItemView.IconSize = listItemData.IconSize;
2027 if (listItemView.IconSize != null)
2029 listItemView.IconPosition = new Position(listItemData.IconPosition.X, (listItemView.Size2D.Height - listItemView.IconSize.Height) / 2);
2033 if (listItemData.CheckImageResourceUrl != null)
2035 listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
2036 listItemView.CheckImageSize = listItemData.CheckImageSize;
2037 if (listItemView.CheckImageSize != null)
2039 listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2);
2043 listItemView.IsSelected = listItemData.IsSelected;
2048 /// Destroy view holder, it can be override.
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)
2056 if (holder.ItemView != null)
2058 holder.ItemView.Dispose();
2063 /// Get item count, it can be override.
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()
2070 return mDatas.Count;