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 dropDownAttributes.ListPadding.CopyFrom(value);
647 if (null == listPadding)
649 listPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
651 dropDownAttributes.ListPadding.Start = start;
652 dropDownAttributes.ListPadding.End = end;
653 dropDownAttributes.ListPadding.Top = top;
654 dropDownAttributes.ListPadding.Bottom = bottom;
656 }, value.Start, value.End, value.Top, value.Bottom);
660 listMargin.CopyFrom(value);
668 /// Add list item by item data. The added item will be added to end of all items automatically.
670 /// <param name="itemData">Item data which will apply to tab item view.</param>
671 /// <since_tizen> 6 </since_tizen>
672 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
673 [EditorBrowsable(EditorBrowsableState.Never)]
674 public void AddItem(DropDownItemData itemData)
676 adapter.InsertData(-1, itemData);
680 /// Delete list item by index.
682 /// <param name="index">Position index where will be deleted.</param>
683 /// <since_tizen> 6 </since_tizen>
684 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
685 [EditorBrowsable(EditorBrowsableState.Never)]
686 public void DeleteItem(int index)
688 if(index < 0 || index >= adapter.GetItemCount())
693 if (selectedItemIndex == index)
695 selectedItemIndex = -1;
697 else if(selectedItemIndex > index)
702 adapter.RemoveData(index);
706 /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
708 /// <param name="item">Item data which will apply to tab item view.</param>
709 /// <param name="index">Position index where will be inserted.</param>
710 /// <since_tizen> 6 </since_tizen>
711 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
712 [EditorBrowsable(EditorBrowsableState.Never)]
713 public void InsertItem(DropDownItemData item, int index)
715 if (index < 0 || index >= adapter.GetItemCount())
720 if (selectedItemIndex >= index)
725 adapter.InsertData(index, item);
729 /// Add scroll bar to list.
731 /// <param name="scrollBar">Scroll bar defined by user which will be added to list.</param>
732 /// <since_tizen> 6 </since_tizen>
733 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
734 [EditorBrowsable(EditorBrowsableState.Never)]
735 public void AttachScrollBar(ScrollBar scrollBar)
741 list.AttachScrollBar(scrollBar);
745 /// Detach scroll bar to list.
747 /// <since_tizen> 6 </since_tizen>
748 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
749 [EditorBrowsable(EditorBrowsableState.Never)]
750 public void DetachScrollBar()
756 list.DetachScrollBar();
760 /// Update DropDown by attributes.
762 /// <since_tizen> 6 </since_tizen>
763 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
764 [EditorBrowsable(EditorBrowsableState.Never)]
765 protected override void OnUpdate()
767 if (dropDownAttributes.HeaderTextAttributes != null)
769 if (headerText == null)
773 ApplyAttributes(headerText, dropDownAttributes.HeaderTextAttributes);
777 if (dropDownAttributes.ButtonAttributes != null)
783 if (dropDownAttributes.Space != null)
785 button.Position2D.X = (int)dropDownAttributes.Space.X;
788 if (dropDownAttributes.ButtonAttributes.TextAttributes != null)
790 ApplyAttributes(buttonText, dropDownAttributes.ButtonAttributes.TextAttributes);
791 button.TextSelector = dropDownAttributes.ButtonAttributes.TextAttributes.Text;
792 if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize != null)
794 button.PointSize = dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All.Value;
796 button.FontFamily = dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily;
797 button.TextColorSelector = dropDownAttributes.ButtonAttributes.TextAttributes.TextColor;
799 if (dropDownAttributes.ButtonAttributes.IconAttributes != null)
801 button.IconURLSelector = dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL;
803 int buttonTextWidth = 0;
804 if (dropDownAttributes.ButtonAttributes.IconAttributes.Size != null)
806 iconWidth = (int)dropDownAttributes.ButtonAttributes.IconAttributes.Size.Width;
808 if (buttonText.NaturalSize2D != null)
810 buttonTextWidth = buttonText.NaturalSize2D.Width;
812 button.SizeWidth = iconWidth + dropDownAttributes.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
816 if (dropDownAttributes.ListBackgroundImageAttributes != null)
818 if (listBackgroundImage == null)
820 CreateListBackgroundImage();
823 ApplyAttributes(listBackgroundImage, dropDownAttributes.ListBackgroundImageAttributes);
824 list.FocusedItemIndex = dropDownAttributes.FocusedItemIndex;
825 list.Size = dropDownAttributes.ListSize;
826 list.Padding = dropDownAttributes.ListPadding;
828 int listBackgroundImageX = 0;
829 int listBackgroundImageY = 0;
830 if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Left)
832 if (dropDownAttributes.ListMargin != null)
834 listBackgroundImageX = (int)dropDownAttributes.ListMargin.Start;
835 listBackgroundImageY = (int)dropDownAttributes.ListMargin.Top;
838 else if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Right)
840 if (dropDownAttributes.ListMargin != null)
843 if (list.Size2D != null)
845 listWidth = list.Size2D.Width;
847 listBackgroundImageX = Size2D.Width - listWidth - (int)dropDownAttributes.ListMargin.End;
848 listBackgroundImageY = (int)dropDownAttributes.ListMargin.Top;
851 listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
856 /// Dispose DropDown and all children on it.
858 /// <param name="type">Dispose type.</param>
859 /// <since_tizen> 6 </since_tizen>
860 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
861 [EditorBrowsable(EditorBrowsableState.Never)]
862 protected override void Dispose(DisposeTypes type)
869 if (type == DisposeTypes.Explicit)
871 if (headerText != null)
873 Utility.Dispose(headerText);
876 if (buttonText != null)
878 Utility.Dispose(buttonText);
883 Utility.Dispose(button);
888 if (listBackgroundImage != null)
890 Utility.Dispose(listBackgroundImage);
893 Utility.Dispose(list);
901 /// Get DropDown attribues.
903 /// <since_tizen> 6 </since_tizen>
904 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
905 [EditorBrowsable(EditorBrowsableState.Never)]
906 protected override Attributes GetAttributes()
908 return new DropDownAttributes();
911 private void Initialize()
913 dropDownAttributes = attributes as DropDownAttributes;
914 if (dropDownAttributes == null)
916 throw new Exception("DropDown attribute parse error.");
918 ApplyAttributes(this, dropDownAttributes);
921 private void OnClickEvent(object sender, ItemClickEventArgs e)
923 ItemClickEvent?.Invoke(sender, e);
926 private void CreateHeaderText()
928 headerText = new TextLabel();
929 headerText.Name = "DropDownHeaderText";
933 private void CreateButton()
935 button = new Button()
937 PositionUsesPivotPoint = true,
938 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
939 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
940 HeightResizePolicy = ResizePolicyType.FillToParent,
941 IconRelativeOrientation = Button.IconOrientation.Right,
943 button.Name = "DropDownButton";
944 button.ClickEvent += ButtonClickEvent;
947 buttonText = new TextLabel()
949 PositionUsesPivotPoint = true,
950 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
951 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
952 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
953 HeightResizePolicy = ResizePolicyType.FillToParent,
955 buttonText.Name = "DropDownButtonText";
960 private void CreateList()
962 list = new FlexibleView();
963 list.Name = "DropDownList";
964 LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
965 list.SetLayoutManager(layoutManager);
966 list.SetAdapter(adapter);
967 list.Focusable = true;
968 list.ItemTouchEvent += ListItemTouchEvent;
969 list.ItemClickEvent += ListItemClickEvent;
970 listBackgroundImage.Add(list);
971 listBackgroundImage.Hide();
974 private void ListItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e)
976 if (e.ClickedView != null)
978 UpdateSelectedItem(e.ClickedView.AdapterPosition);
980 ItemClickEventArgs args = new ItemClickEventArgs();
981 args.Index = e.ClickedView.AdapterPosition;
982 args.Text = (e.ClickedView.ItemView as DropDownItemView)?.Text;
983 OnClickEvent(this, args);
986 listBackgroundImage.Hide();
989 private void ListItemTouchEvent(object sender, FlexibleView.ItemTouchEventArgs e)
991 PointStateType state = e.Touch.GetState(0);
994 case PointStateType.Down:
995 if (e.TouchedView != null)
997 touchedView = e.TouchedView.ItemView as DropDownItemView;
998 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1000 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
1004 case PointStateType.Motion:
1005 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1007 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
1010 case PointStateType.Up:
1011 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1013 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
1021 private void UpdateSelectedItem(int index)
1023 if (selectedItemIndex != -1)
1025 DropDownItemData data = adapter.GetData(selectedItemIndex);
1028 data.IsSelected = false;
1030 DropDownItemView view = list?.FindViewHolderForAdapterPosition(selectedItemIndex)?.ItemView as DropDownItemView;
1033 view.IsSelected = false;
1039 DropDownItemData data = adapter.GetData(index);
1042 data.IsSelected = true;
1044 DropDownItemView view = list?.FindViewHolderForAdapterPosition(index)?.ItemView as DropDownItemView;
1047 view.IsSelected = true;
1048 button.Text = view.Text;
1052 selectedItemIndex = index;
1055 private void CreateListBackgroundImage()
1057 listBackgroundImage = new ImageView
1059 Name = "ListBackgroundImage",
1060 PositionUsesPivotPoint = true,
1061 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1062 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1063 WidthResizePolicy = ResizePolicyType.FitToChildren,
1064 HeightResizePolicy = ResizePolicyType.FitToChildren,
1066 Add(listBackgroundImage);
1069 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
1071 listBackgroundImage.Show();
1074 private void CreateHeaderTextAttributes()
1076 if (dropDownAttributes.HeaderTextAttributes == null)
1078 dropDownAttributes.HeaderTextAttributes = new TextAttributes()
1080 PositionUsesPivotPoint = true,
1081 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1082 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1083 WidthResizePolicy = ResizePolicyType.FillToParent,
1084 HeightResizePolicy = ResizePolicyType.FillToParent,
1085 HorizontalAlignment = HorizontalAlignment.Center,
1086 VerticalAlignment = VerticalAlignment.Center,
1091 private void CreateButtonAttributes()
1093 if (dropDownAttributes.ButtonAttributes == null)
1095 dropDownAttributes.ButtonAttributes = new ButtonAttributes();
1099 private void CreateButtonTextAttributes()
1101 CreateButtonAttributes();
1103 if (dropDownAttributes.ButtonAttributes.TextAttributes == null)
1105 dropDownAttributes.ButtonAttributes.TextAttributes = new TextAttributes
1107 PositionUsesPivotPoint = true,
1108 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1109 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1110 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1111 HeightResizePolicy = ResizePolicyType.FillToParent,
1112 Position = new Position(0, 0),
1113 HorizontalAlignment = HorizontalAlignment.Begin,
1114 VerticalAlignment = VerticalAlignment.Center,
1119 private void CreateButtonIconAttributes()
1121 CreateButtonAttributes();
1123 if (dropDownAttributes.ButtonAttributes.IconAttributes == null)
1125 dropDownAttributes.ButtonAttributes.IconAttributes = new ImageAttributes
1127 PositionUsesPivotPoint = true,
1128 ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight,
1129 PivotPoint = Tizen.NUI.PivotPoint.CenterRight,
1134 private void CreateListBackgroundAttributes()
1136 if (dropDownAttributes.ListBackgroundImageAttributes == null)
1138 dropDownAttributes.ListBackgroundImageAttributes = new ImageAttributes
1140 PositionUsesPivotPoint = true,
1141 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1142 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1148 #region ItemClickEventArgs
1150 /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
1152 /// <since_tizen> 6 </since_tizen>
1153 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1154 [EditorBrowsable(EditorBrowsableState.Never)]
1155 public class ItemClickEventArgs : EventArgs
1157 /// <summary> Clicked item index of DropDown's list </summary>
1158 /// <since_tizen> 6 </since_tizen>
1159 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1160 [EditorBrowsable(EditorBrowsableState.Never)]
1162 /// <summary> Clicked item text string of DropDown's list </summary>
1163 /// <since_tizen> 6 </since_tizen>
1164 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1165 [EditorBrowsable(EditorBrowsableState.Never)]
1170 #region DropDownItemData
1172 /// DropDownItemData is a class to record all data which will be applied to DropDown item.
1174 /// <since_tizen> 6 </since_tizen>
1175 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1176 [EditorBrowsable(EditorBrowsableState.Never)]
1177 public class DropDownItemData
1179 private DropDownItemAttributes itemDataAttributes = new DropDownItemAttributes();
1182 /// Creates a new instance of a DropDownItemData.
1184 /// <since_tizen> 6 </since_tizen>
1185 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1186 [EditorBrowsable(EditorBrowsableState.Never)]
1187 public DropDownItemData()
1193 /// Creates a new instance of a DropDownItemData with style.
1195 /// <param name="style">Create DropDownItemData by special style defined in UX.</param>
1196 /// <since_tizen> 6 </since_tizen>
1197 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1198 [EditorBrowsable(EditorBrowsableState.Never)]
1199 public DropDownItemData(string style)
1203 Attributes attributes = StyleManager.Instance.GetAttributes(style);
1204 if(attributes == null)
1206 throw new InvalidOperationException($"There is no style {style}");
1208 itemDataAttributes = attributes as DropDownItemAttributes;
1214 /// Creates a new instance of a DropDownItemData with attributes.
1216 /// <param name="attributes">Create DropDownItemData by attributes customized by user.</param>
1217 /// <since_tizen> 6 </since_tizen>
1218 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1219 [EditorBrowsable(EditorBrowsableState.Never)]
1220 public DropDownItemData(DropDownItemAttributes attributes)
1222 itemDataAttributes = attributes.Clone() as DropDownItemAttributes;
1227 /// DropDown item size.
1229 /// <since_tizen> 6 </since_tizen>
1230 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1231 [EditorBrowsable(EditorBrowsableState.Never)]
1236 return itemDataAttributes.Size;
1240 itemDataAttributes.Size = value;
1245 /// DropDown item background color selector.
1247 /// <since_tizen> 6 </since_tizen>
1248 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1249 [EditorBrowsable(EditorBrowsableState.Never)]
1250 public ColorSelector BackgroundColorSelector
1254 return itemDataAttributes.BackgroundColor;
1258 if (itemDataAttributes.BackgroundColor == null)
1260 itemDataAttributes.BackgroundColor = value.Clone() as ColorSelector;
1264 itemDataAttributes.BackgroundColor = value.Clone();
1271 /// DropDown item text string.
1273 /// <since_tizen> 6 </since_tizen>
1274 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1275 [EditorBrowsable(EditorBrowsableState.Never)]
1280 return itemDataAttributes.TextAttributes?.Text?.All;
1284 CreateTextAttributes();
1285 if (itemDataAttributes.TextAttributes.Text == null)
1287 itemDataAttributes.TextAttributes.Text = new StringSelector { All = value };
1291 itemDataAttributes.TextAttributes.Text.All = value;
1297 /// DropDown item text's point size.
1299 /// <since_tizen> 6 </since_tizen>
1300 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1301 [EditorBrowsable(EditorBrowsableState.Never)]
1302 public float PointSize
1306 return itemDataAttributes.TextAttributes?.PointSize?.All ?? 0;
1310 CreateTextAttributes();
1311 if (itemDataAttributes.TextAttributes.PointSize == null)
1313 itemDataAttributes.TextAttributes.PointSize = new FloatSelector { All = value };
1317 itemDataAttributes.TextAttributes.PointSize.All = value;
1323 /// DropDown item text's font family.
1325 /// <since_tizen> 6 </since_tizen>
1326 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1327 [EditorBrowsable(EditorBrowsableState.Never)]
1328 public string FontFamily
1332 return itemDataAttributes.TextAttributes?.FontFamily;
1336 CreateTextAttributes();
1337 itemDataAttributes.TextAttributes.FontFamily = value;
1342 /// DropDown item text's position.
1344 /// <since_tizen> 6 </since_tizen>
1345 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1346 [EditorBrowsable(EditorBrowsableState.Never)]
1347 public Position TextPosition
1351 return itemDataAttributes.TextAttributes?.Position;
1355 CreateTextAttributes();
1356 itemDataAttributes.TextAttributes.Position = value;
1361 /// DropDown item's icon's resource url.
1363 /// <since_tizen> 6 </since_tizen>
1364 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1365 [EditorBrowsable(EditorBrowsableState.Never)]
1366 public string IconResourceUrl
1370 return itemDataAttributes.IconAttributes?.ResourceURL?.All;
1374 CreateIconAttributes();
1375 if (itemDataAttributes.IconAttributes.ResourceURL == null)
1377 itemDataAttributes.IconAttributes.ResourceURL = new StringSelector { All = value };
1381 itemDataAttributes.IconAttributes.ResourceURL.All = value;
1387 /// DropDown item's icon's size.
1389 /// <since_tizen> 6 </since_tizen>
1390 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1391 [EditorBrowsable(EditorBrowsableState.Never)]
1392 public Size IconSize
1396 return itemDataAttributes.IconAttributes?.Size;
1400 CreateIconAttributes();
1401 itemDataAttributes.IconAttributes.Size = value;
1406 /// DropDown item's icon's position.
1408 /// <since_tizen> 6 </since_tizen>
1409 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1410 [EditorBrowsable(EditorBrowsableState.Never)]
1411 public Position IconPosition
1415 return itemDataAttributes.IconAttributes.Position;
1419 CreateIconAttributes();
1420 itemDataAttributes.IconAttributes.Position = value;
1425 /// DropDown item's check image's resource url.
1427 /// <since_tizen> 6 </since_tizen>
1428 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1429 [EditorBrowsable(EditorBrowsableState.Never)]
1430 public string CheckImageResourceUrl
1434 return itemDataAttributes.CheckImageAttributes?.ResourceURL?.All;
1438 CreateCheckImageAttributes();
1439 if (itemDataAttributes.CheckImageAttributes.ResourceURL == null)
1441 itemDataAttributes.CheckImageAttributes.ResourceURL = new StringSelector { All = value };
1445 itemDataAttributes.CheckImageAttributes.ResourceURL.All = value;
1451 /// DropDown item's check image's size.
1453 /// <since_tizen> 6 </since_tizen>
1454 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1455 [EditorBrowsable(EditorBrowsableState.Never)]
1456 public Size CheckImageSize
1460 return itemDataAttributes.CheckImageAttributes?.Size;
1464 CreateCheckImageAttributes();
1465 itemDataAttributes.CheckImageAttributes.Size = value;
1470 /// DropDown item's check image's right space.
1472 /// <since_tizen> 6 </since_tizen>
1473 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1474 [EditorBrowsable(EditorBrowsableState.Never)]
1475 public int CheckImageRightSpace
1479 return itemDataAttributes.CheckImageGapToBoundary;
1483 itemDataAttributes.CheckImageGapToBoundary = value;
1488 /// Flag to decide DropDown item is selected or not.
1490 /// <since_tizen> 6 </since_tizen>
1491 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1492 [EditorBrowsable(EditorBrowsableState.Never)]
1493 public bool IsSelected
1497 return itemDataAttributes.IsSelected;
1501 itemDataAttributes.IsSelected = value;
1505 private void Initalize()
1507 if (itemDataAttributes == null)
1509 throw new Exception("Button attribute parse error.");
1513 private void CreateTextAttributes()
1515 if(itemDataAttributes.TextAttributes == null)
1517 itemDataAttributes.TextAttributes = new TextAttributes
1519 PositionUsesPivotPoint = true,
1520 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1521 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1522 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1523 HeightResizePolicy = ResizePolicyType.FillToParent,
1524 VerticalAlignment = VerticalAlignment.Center,
1525 HorizontalAlignment = HorizontalAlignment.Begin,
1530 private void CreateIconAttributes()
1532 if (itemDataAttributes.IconAttributes == null)
1534 itemDataAttributes.IconAttributes = new ImageAttributes
1536 PositionUsesPivotPoint = true,
1537 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1538 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1543 private void CreateCheckImageAttributes()
1545 if (itemDataAttributes.CheckImageAttributes == null)
1547 itemDataAttributes.CheckImageAttributes = new ImageAttributes
1549 PositionUsesPivotPoint = true,
1550 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1551 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1558 #region DropDownItemView
1559 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1560 [EditorBrowsable(EditorBrowsableState.Never)]
1561 internal class DropDownItemView : Control
1563 private TextLabel mText = null;
1564 private ImageView mIcon = null;
1565 private ImageView mCheck = null;
1567 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1568 [EditorBrowsable(EditorBrowsableState.Never)]
1569 public DropDownItemView() : base()
1573 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1574 [EditorBrowsable(EditorBrowsableState.Never)]
1575 public ColorSelector BackgroundColorSelector
1581 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1582 [EditorBrowsable(EditorBrowsableState.Never)]
1600 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1601 [EditorBrowsable(EditorBrowsableState.Never)]
1602 public string FontFamily
1610 return mText.FontFamily;
1615 mText.FontFamily = value;
1619 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1620 [EditorBrowsable(EditorBrowsableState.Never)]
1621 public float PointSize
1629 return mText.PointSize;
1634 mText.PointSize = value;
1638 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1639 [EditorBrowsable(EditorBrowsableState.Never)]
1640 public Color TextColor
1648 return mText.TextColor;
1653 mText.TextColor = value;
1657 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1658 [EditorBrowsable(EditorBrowsableState.Never)]
1659 public Position TextPosition
1667 return mText.Position;
1672 mText.Position = value;
1676 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1677 [EditorBrowsable(EditorBrowsableState.Never)]
1678 public string IconResourceUrl
1686 return mIcon.ResourceUrl;
1691 mIcon.ResourceUrl = value;
1695 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1696 [EditorBrowsable(EditorBrowsableState.Never)]
1697 public Size IconSize
1714 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1715 [EditorBrowsable(EditorBrowsableState.Never)]
1716 public Position IconPosition
1724 return mIcon.Position;
1729 mIcon.Position = value;
1733 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1734 [EditorBrowsable(EditorBrowsableState.Never)]
1735 public string CheckResourceUrl
1743 return mCheck.ResourceUrl;
1748 mCheck.ResourceUrl = value;
1752 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1753 [EditorBrowsable(EditorBrowsableState.Never)]
1754 public Position CheckPosition
1762 return mCheck.Position;
1767 mCheck.Position = value;
1771 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1772 [EditorBrowsable(EditorBrowsableState.Never)]
1773 public Size CheckImageSize
1786 mCheck.Size = value;
1790 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1791 [EditorBrowsable(EditorBrowsableState.Never)]
1792 public bool IsSelected
1800 return mCheck.Visibility;
1816 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1817 [EditorBrowsable(EditorBrowsableState.Never)]
1818 protected override void Dispose(DisposeTypes type)
1825 if (type == DisposeTypes.Explicit)
1851 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1852 [EditorBrowsable(EditorBrowsableState.Never)]
1853 protected override Attributes GetAttributes()
1858 private void CreateIcon()
1862 mIcon = new ImageView()
1864 PositionUsesPivotPoint = true,
1865 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1866 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1872 private void CreateText()
1876 mText = new TextLabel()
1878 PositionUsesPivotPoint = true,
1879 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1880 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1881 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1882 HeightResizePolicy = ResizePolicyType.FillToParent,
1883 VerticalAlignment = VerticalAlignment.Center,
1884 HorizontalAlignment = HorizontalAlignment.Begin,
1890 private void CreateCheckImage()
1894 mCheck = new ImageView()
1896 PositionUsesPivotPoint = true,
1897 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1898 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1907 #region DropDownListBridge
1910 /// DropDownListBridge is bridge to contact item data and item view.
1912 /// <since_tizen> 6 </since_tizen>
1913 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1914 [EditorBrowsable(EditorBrowsableState.Never)]
1915 public class DropDownListBridge : FlexibleView.Adapter
1917 private List<DropDownItemData> mDatas = new List<DropDownItemData>();
1920 /// Creates a new instance of a DropDownListBridge.
1922 /// <since_tizen> 6 </since_tizen>
1923 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1924 [EditorBrowsable(EditorBrowsableState.Never)]
1925 public DropDownListBridge()
1930 /// Insert data. The inserted data will be added to the special position by index automatically.
1932 /// <param name="position">Position index where will be inserted.</param>
1933 /// <param name="data">Item data which will apply to tab item view.</param>
1934 /// <since_tizen> 6 </since_tizen>
1935 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1936 [EditorBrowsable(EditorBrowsableState.Never)]
1937 public void InsertData(int position, DropDownItemData data)
1941 position = mDatas.Count;
1943 mDatas.Insert(position, data);
1944 NotifyItemInserted(position);
1948 /// Remove data by position.
1950 /// <param name="position">Position index where will be removed.</param>
1951 /// <since_tizen> 6 </since_tizen>
1952 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1953 [EditorBrowsable(EditorBrowsableState.Never)]
1954 public void RemoveData(int position)
1956 mDatas.RemoveAt(position);
1957 NotifyItemRemoved(position);
1961 /// Get data by position.
1963 /// <param name="position">Position index where will be gotten.</param>
1964 /// <since_tizen> 6 </since_tizen>
1965 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1966 [EditorBrowsable(EditorBrowsableState.Never)]
1967 public DropDownItemData GetData(int position)
1969 return mDatas[position];
1973 /// Get view holder by view type.
1975 /// <param name="viewType">Create item view.</param>
1976 /// <since_tizen> 6 </since_tizen>
1977 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1978 [EditorBrowsable(EditorBrowsableState.Never)]
1979 public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
1981 FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new DropDownItemView());
1987 /// Binder view holder, it can be override.
1989 /// <param name="holder">View holder.</param>
1990 /// <param name="position">Position index where will be gotten.</param>
1991 /// <since_tizen> 6 </since_tizen>
1992 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1993 [EditorBrowsable(EditorBrowsableState.Never)]
1994 public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position)
1996 DropDownItemData listItemData = mDatas[position];
1997 if(listItemData == null)
2001 DropDownItemView listItemView = holder.ItemView as DropDownItemView;
2002 listItemView.Name = "Item" + position;
2003 if (listItemData.Size != null)
2005 holder.ItemView.Size = listItemData.Size;
2008 if (listItemView != null)
2010 listItemView.BackgroundColorSelector = listItemData.BackgroundColorSelector;
2011 if (listItemData.Text != null)
2013 listItemView.Text = listItemData.Text;
2014 listItemView.PointSize = listItemData.PointSize;
2015 listItemView.FontFamily = listItemData.FontFamily;
2016 listItemView.TextPosition = listItemData.TextPosition;
2019 if (listItemData.IconResourceUrl != null)
2021 listItemView.IconResourceUrl = listItemData.IconResourceUrl;
2022 listItemView.IconSize = listItemData.IconSize;
2023 if (listItemView.IconSize != null)
2025 listItemView.IconPosition = new Position(listItemData.IconPosition.X, (listItemView.Size2D.Height - listItemView.IconSize.Height) / 2);
2029 if (listItemData.CheckImageResourceUrl != null)
2031 listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
2032 listItemView.CheckImageSize = listItemData.CheckImageSize;
2033 if (listItemView.CheckImageSize != null)
2035 listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2);
2039 listItemView.IsSelected = listItemData.IsSelected;
2044 /// Destroy view holder, it can be override.
2046 /// <param name="holder">View holder.</param>
2047 /// <since_tizen> 6 </since_tizen>
2048 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2049 [EditorBrowsable(EditorBrowsableState.Never)]
2050 public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder)
2052 if (holder.ItemView != null)
2054 holder.ItemView.Dispose();
2059 /// Get item count, it can be override.
2061 /// <since_tizen> 6 </since_tizen>
2062 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2063 [EditorBrowsable(EditorBrowsableState.Never)]
2064 public override int GetItemCount()
2066 return mDatas.Count;