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;
44 /// Creates a new instance of a DropDown.
46 /// <since_tizen> 6 </since_tizen>
47 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
48 [EditorBrowsable(EditorBrowsableState.Never)]
49 public DropDown() : base()
54 /// Creates a new instance of a DropDown with style.
56 /// <param name="style">Create DropDown by special style defined in UX.</param>
57 /// <since_tizen> 6 </since_tizen>
58 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
59 [EditorBrowsable(EditorBrowsableState.Never)]
60 public DropDown(string style) : base(style)
65 /// Creates a new instance of a DropDown with attributes.
67 /// <param name="attributes">Create DropDown by attributes customized by user.</param>
68 /// <since_tizen> 6 </since_tizen>
69 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public DropDown(DropDownAttributes attributes) : base(attributes)
77 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
79 /// <since_tizen> 6 </since_tizen>
80 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public delegate void ClickEventHandler<ClickEventArgs>(object sender, ClickEventArgs e);
85 /// An event for the item clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
87 /// <since_tizen> 6 </since_tizen>
88 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
89 [EditorBrowsable(EditorBrowsableState.Never)]
90 public event ClickEventHandler<ItemClickEventArgs> ItemClickEvent;
95 /// <since_tizen> 6 </since_tizen>
96 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public enum ListOrientation
103 /// <since_tizen> 6 </since_tizen>
104 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
105 [EditorBrowsable(EditorBrowsableState.Never)]
110 /// <since_tizen> 6 </since_tizen>
111 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
112 [EditorBrowsable(EditorBrowsableState.Never)]
117 /// Header text string in DropDown.
119 /// <since_tizen> 6 </since_tizen>
120 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public string HeaderText
126 return dropDownAttributes.HeaderTextAttributes?.Text.All;
132 CreateHeaderTextAttributes();
133 if (dropDownAttributes.HeaderTextAttributes.Text == null)
135 dropDownAttributes.HeaderTextAttributes.Text = new StringSelector();
137 dropDownAttributes.HeaderTextAttributes.Text.All = value;
144 /// Header text point size in DropDown.
146 /// <since_tizen> 6 </since_tizen>
147 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
148 [EditorBrowsable(EditorBrowsableState.Never)]
149 public float HeaderTextPointSize
153 return dropDownAttributes.HeaderTextAttributes?.PointSize?.All ?? 0;
157 CreateHeaderTextAttributes();
158 if (dropDownAttributes.HeaderTextAttributes.PointSize == null)
160 dropDownAttributes.HeaderTextAttributes.PointSize = new FloatSelector();
162 dropDownAttributes.HeaderTextAttributes.PointSize.All = value;
168 /// Header text font family in DropDown.
170 /// <since_tizen> 6 </since_tizen>
171 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
172 [EditorBrowsable(EditorBrowsableState.Never)]
173 public string HeaderTextFontFamily
177 return dropDownAttributes.HeaderTextAttributes?.FontFamily;
181 CreateHeaderTextAttributes();
182 dropDownAttributes.HeaderTextAttributes.FontFamily = value;
188 /// Header text color in DropDown.
190 /// <since_tizen> 6 </since_tizen>
191 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
192 [EditorBrowsable(EditorBrowsableState.Never)]
193 public Color HeaderTextColor
197 return dropDownAttributes.HeaderTextAttributes?.TextColor?.All;
201 CreateHeaderTextAttributes();
202 if (dropDownAttributes.HeaderTextAttributes.TextColor == null)
204 dropDownAttributes.HeaderTextAttributes.TextColor = new ColorSelector();
206 dropDownAttributes.HeaderTextAttributes.TextColor.All = value;
212 /// Header text color selector in DropDown.
214 /// <since_tizen> 6 </since_tizen>
215 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
216 [EditorBrowsable(EditorBrowsableState.Never)]
217 public ColorSelector HeaderTextColorSelector
221 return dropDownAttributes.HeaderTextAttributes?.TextColor;
225 CreateHeaderTextAttributes();
228 dropDownAttributes.HeaderTextAttributes.TextColor = value.Clone() as ColorSelector;
235 /// Button text string in DropDown.
237 /// <since_tizen> 6 </since_tizen>
238 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
239 [EditorBrowsable(EditorBrowsableState.Never)]
240 public string ButtonText
244 return dropDownAttributes.ButtonAttributes?.TextAttributes?.Text.All;
250 CreateButtonTextAttributes();
251 if (dropDownAttributes.ButtonAttributes.TextAttributes.Text == null)
253 dropDownAttributes.ButtonAttributes.TextAttributes.Text = new StringSelector();
255 dropDownAttributes.ButtonAttributes.TextAttributes.Text.All = value;
262 /// Button text point size in DropDown.
264 /// <since_tizen> 6 </since_tizen>
265 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
266 [EditorBrowsable(EditorBrowsableState.Never)]
267 public float ButtonTextPointSize
271 return dropDownAttributes.ButtonAttributes?.TextAttributes?.PointSize?.All ?? 0;
275 CreateButtonTextAttributes();
276 if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize == null)
278 dropDownAttributes.ButtonAttributes.TextAttributes.PointSize = new FloatSelector();
280 dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All = value;
286 /// Button text font family in DropDown.
288 /// <since_tizen> 6 </since_tizen>
289 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
290 [EditorBrowsable(EditorBrowsableState.Never)]
291 public string ButtonTextFontFamily
295 return dropDownAttributes.ButtonAttributes?.TextAttributes?.FontFamily;
299 CreateButtonTextAttributes();
300 dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily = value;
306 /// Button text color in DropDown.
308 /// <since_tizen> 6 </since_tizen>
309 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
310 [EditorBrowsable(EditorBrowsableState.Never)]
311 public Color ButtonTextColor
315 return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor?.All;
319 CreateButtonTextAttributes();
320 if (dropDownAttributes.ButtonAttributes.TextAttributes.TextColor == null)
322 dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = new ColorSelector();
324 dropDownAttributes.ButtonAttributes.TextAttributes.TextColor.All = value;
330 /// Button text color selector in DropDown.
332 /// <since_tizen> 6 </since_tizen>
333 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
334 [EditorBrowsable(EditorBrowsableState.Never)]
335 public ColorSelector ButtonTextColorSelector
339 return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor;
343 CreateButtonTextAttributes();
346 dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector;
353 /// Button icon image's resource url in DropDown.
355 /// <since_tizen> 6 </since_tizen>
356 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 public string ButtonIconImageURL
362 return dropDownAttributes.ButtonAttributes?.IconAttributes?.ResourceURL.All;
368 CreateButtonIconAttributes();
369 if (dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL == null)
371 dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL = new StringSelector();
373 dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL.All = value;
380 /// Button icon image's size in DropDown.
382 /// <since_tizen> 6 </since_tizen>
383 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
384 [EditorBrowsable(EditorBrowsableState.Never)]
385 public Size2D ButtonIconSize2D
389 return dropDownAttributes.ButtonAttributes?.IconAttributes?.Size2D;
395 CreateButtonIconAttributes();
396 dropDownAttributes.ButtonAttributes.IconAttributes.Size2D = value;
403 /// Space between button text and button icon in DropDown.
405 /// <since_tizen> 6 </since_tizen>
406 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
407 [EditorBrowsable(EditorBrowsableState.Never)]
408 public int SpaceBetweenButtonTextAndIcon
412 return dropDownAttributes.SpaceBetweenButtonTextAndIcon;
416 dropDownAttributes.SpaceBetweenButtonTextAndIcon = value;
422 /// Left space in DropDown.
424 /// <since_tizen> 6 </since_tizen>
425 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
426 [EditorBrowsable(EditorBrowsableState.Never)]
431 return (int)dropDownAttributes.Space.X;
435 dropDownAttributes.Space.X = value;
441 /// Right space in DropDown.
443 /// <since_tizen> 6 </since_tizen>
444 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
445 [EditorBrowsable(EditorBrowsableState.Never)]
446 public int RightSpace
450 return (int)dropDownAttributes.Space.Y;
454 dropDownAttributes.Space.Y = value;
460 /// List background image's resource url in DropDown.
462 /// <since_tizen> 6 </since_tizen>
463 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
464 [EditorBrowsable(EditorBrowsableState.Never)]
465 public string ListBackgroundImageURL
469 return dropDownAttributes.ListBackgroundImageAttributes?.ResourceURL?.All;
475 CreateListBackgroundAttributes();
476 if (dropDownAttributes.ListBackgroundImageAttributes.ResourceURL == null)
478 dropDownAttributes.ListBackgroundImageAttributes.ResourceURL = new StringSelector();
480 dropDownAttributes.ListBackgroundImageAttributes.ResourceURL.All = value;
487 /// List background image's border in DropDown.
489 /// <since_tizen> 6 </since_tizen>
490 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
491 [EditorBrowsable(EditorBrowsableState.Never)]
492 public Rectangle ListBackgroundImageBorder
496 return dropDownAttributes.ListBackgroundImageAttributes?.Border?.All;
502 CreateListBackgroundAttributes();
503 if (dropDownAttributes.ListBackgroundImageAttributes.Border == null)
505 dropDownAttributes.ListBackgroundImageAttributes.Border = new RectangleSelector();
507 dropDownAttributes.ListBackgroundImageAttributes.Border.All = value;
514 /// List relative orientation in DropDown.
516 /// <since_tizen> 6 </since_tizen>
517 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
518 [EditorBrowsable(EditorBrowsableState.Never)]
519 public ListOrientation ListRelativeOrientation
523 return dropDownAttributes.ListRelativeOrientation;
527 dropDownAttributes.ListRelativeOrientation = value;
533 /// Left space in list.
535 /// <since_tizen> 6 </since_tizen>
536 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
537 [EditorBrowsable(EditorBrowsableState.Never)]
538 public int ListLeftMargin
542 return (int)dropDownAttributes.ListMargin.X;
546 dropDownAttributes.ListMargin.X = value;
552 /// Right space in list.
554 /// <since_tizen> 6 </since_tizen>
555 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
556 [EditorBrowsable(EditorBrowsableState.Never)]
557 public int ListRigthMargin
561 return (int)dropDownAttributes.ListMargin.Y;
565 dropDownAttributes.ListMargin.Y = value;
571 /// Top space in list.
573 /// <since_tizen> 6 </since_tizen>
574 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
575 [EditorBrowsable(EditorBrowsableState.Never)]
576 public int ListTopMargin
580 return (int)dropDownAttributes.ListMargin.Z;
584 dropDownAttributes.ListMargin.Z = value;
590 /// Focused item index in list.
592 /// <since_tizen> 6 </since_tizen>
593 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
594 [EditorBrowsable(EditorBrowsableState.Never)]
595 public int FocusedItemIndex
599 return dropDownAttributes.FocusedItemIndex;
603 dropDownAttributes.FocusedItemIndex = value;
609 /// Selected item index in list.
611 /// <since_tizen> 6 </since_tizen>
612 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
613 [EditorBrowsable(EditorBrowsableState.Never)]
614 public int SelectedItemIndex
618 return selectedItemIndex;
622 if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount())
626 UpdateSelectedItem(value);
631 /// List size in DropDown.
633 /// <since_tizen> 6 </since_tizen>
634 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
635 [EditorBrowsable(EditorBrowsableState.Never)]
636 public Size2D ListSize2D
640 return dropDownAttributes.ListSize2D;
644 dropDownAttributes.ListSize2D = value;
650 /// List padding in DropDown.
652 /// <since_tizen> 6 </since_tizen>
653 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
654 [EditorBrowsable(EditorBrowsableState.Never)]
655 public Extents ListPadding
659 return dropDownAttributes.ListPadding;
663 dropDownAttributes.ListPadding = value;
669 /// Add list item by item data. The added item will be added to end of all items automatically.
671 /// <param name="itemData">Item data which will apply to tab item view.</param>
672 /// <since_tizen> 6 </since_tizen>
673 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
674 [EditorBrowsable(EditorBrowsableState.Never)]
675 public void AddItem(DropDownItemData itemData)
677 adapter.InsertData(-1, itemData);
681 /// Delete list item by index.
683 /// <param name="index">Position index where will be deleted.</param>
684 /// <since_tizen> 6 </since_tizen>
685 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
686 [EditorBrowsable(EditorBrowsableState.Never)]
687 public void DeleteItem(int index)
689 if(index < 0 || index >= adapter.GetItemCount())
694 if (selectedItemIndex == index)
696 selectedItemIndex = -1;
698 else if(selectedItemIndex > index)
703 adapter.RemoveData(index);
707 /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
709 /// <param name="item">Item data which will apply to tab item view.</param>
710 /// <param name="index">Position index where will be inserted.</param>
711 /// <since_tizen> 6 </since_tizen>
712 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
713 [EditorBrowsable(EditorBrowsableState.Never)]
714 public void InsertItem(DropDownItemData item, int index)
716 if (index < 0 || index >= adapter.GetItemCount())
721 if (selectedItemIndex >= index)
726 adapter.InsertData(index, item);
730 /// Add scroll bar to list.
732 /// <param name="scrollBar">Scroll bar defined by user which will be added to list.</param>
733 /// <since_tizen> 6 </since_tizen>
734 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
735 [EditorBrowsable(EditorBrowsableState.Never)]
736 public void AttachScrollBar(ScrollBar scrollBar)
742 list.AttachScrollBar(scrollBar);
746 /// Detach scroll bar to list.
748 /// <since_tizen> 6 </since_tizen>
749 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
750 [EditorBrowsable(EditorBrowsableState.Never)]
751 public void DetachScrollBar()
757 list.DetachScrollBar();
761 /// Update DropDown by attributes.
763 /// <since_tizen> 6 </since_tizen>
764 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
765 [EditorBrowsable(EditorBrowsableState.Never)]
766 protected override void OnUpdate()
768 if (dropDownAttributes.HeaderTextAttributes != null)
770 if (headerText == null)
774 ApplyAttributes(headerText, dropDownAttributes.HeaderTextAttributes);
778 if (dropDownAttributes.ButtonAttributes != null)
784 if (dropDownAttributes.Space != null)
786 button.Position2D.X = (int)dropDownAttributes.Space.X;
789 if (dropDownAttributes.ButtonAttributes.TextAttributes != null)
791 ApplyAttributes(buttonText, dropDownAttributes.ButtonAttributes.TextAttributes);
792 button.TextSelector = dropDownAttributes.ButtonAttributes.TextAttributes.Text;
793 if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize != null)
795 button.PointSize = dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All.Value;
797 button.FontFamily = dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily;
798 button.TextColorSelector = dropDownAttributes.ButtonAttributes.TextAttributes.TextColor;
800 if (dropDownAttributes.ButtonAttributes.IconAttributes != null)
802 button.IconURLSelector = dropDownAttributes.ButtonAttributes.IconAttributes.ResourceURL;
804 int buttonTextWidth = 0;
805 if (dropDownAttributes.ButtonAttributes.IconAttributes.Size2D != null)
807 iconWidth = dropDownAttributes.ButtonAttributes.IconAttributes.Size2D.Width;
809 if (buttonText.NaturalSize2D != null)
811 buttonTextWidth = buttonText.NaturalSize2D.Width;
813 button.SizeWidth = iconWidth + dropDownAttributes.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
817 if (dropDownAttributes.ListBackgroundImageAttributes != null)
819 if (listBackgroundImage == null)
821 CreateListBackgroundImage();
824 ApplyAttributes(listBackgroundImage, dropDownAttributes.ListBackgroundImageAttributes);
825 list.FocusedItemIndex = dropDownAttributes.FocusedItemIndex;
826 list.Size2D = dropDownAttributes.ListSize2D;
827 list.Padding = dropDownAttributes.ListPadding;
829 int listBackgroundImageX = 0;
830 int listBackgroundImageY = 0;
831 if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Left)
833 if (dropDownAttributes.ListMargin != null)
835 listBackgroundImageX = (int)dropDownAttributes.ListMargin.X;
836 listBackgroundImageY = (int)dropDownAttributes.ListMargin.Z;
839 else if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Right)
841 if (dropDownAttributes.ListMargin != null)
844 if (list.Size2D != null)
846 listWidth = list.Size2D.Width;
848 listBackgroundImageX = Size2D.Width - listWidth - (int)dropDownAttributes.ListMargin.Y;
849 listBackgroundImageY = (int)dropDownAttributes.ListMargin.Z;
852 listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
857 /// Dispose DropDown and all children on it.
859 /// <param name="type">Dispose type.</param>
860 /// <since_tizen> 6 </since_tizen>
861 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
862 [EditorBrowsable(EditorBrowsableState.Never)]
863 protected override void Dispose(DisposeTypes type)
870 if (type == DisposeTypes.Explicit)
872 if (headerText != null)
874 Utility.Dispose(headerText);
877 if (buttonText != null)
879 Utility.Dispose(buttonText);
884 Utility.Dispose(button);
889 if (listBackgroundImage != null)
891 Utility.Dispose(listBackgroundImage);
894 Utility.Dispose(list);
902 /// Get DropDown attribues.
904 /// <since_tizen> 6 </since_tizen>
905 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
906 [EditorBrowsable(EditorBrowsableState.Never)]
907 protected override Attributes GetAttributes()
909 return new DropDownAttributes();
912 private void Initialize()
914 dropDownAttributes = attributes as DropDownAttributes;
915 if (dropDownAttributes == null)
917 throw new Exception("DropDown attribute parse error.");
919 ApplyAttributes(this, dropDownAttributes);
922 private void OnClickEvent(object sender, ItemClickEventArgs e)
924 ItemClickEvent?.Invoke(sender, e);
927 private void CreateHeaderText()
929 headerText = new TextLabel();
930 headerText.Name = "DropDownHeaderText";
934 private void CreateButton()
936 button = new Button()
938 PositionUsesPivotPoint = true,
939 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
940 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
941 HeightResizePolicy = ResizePolicyType.FillToParent,
942 IconRelativeOrientation = Button.IconOrientation.Right,
944 button.Name = "DropDownButton";
945 button.ClickEvent += ButtonClickEvent;
948 buttonText = new TextLabel()
950 PositionUsesPivotPoint = true,
951 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
952 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
953 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
954 HeightResizePolicy = ResizePolicyType.FillToParent,
956 buttonText.Name = "DropDownButtonText";
961 private void CreateList()
963 list = new FlexibleView();
964 list.Name = "DropDownList";
965 LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
966 list.SetLayoutManager(layoutManager);
967 list.SetAdapter(adapter);
968 list.Focusable = true;
969 list.ItemTouchEvent += ListItemTouchEvent;
970 list.ItemClickEvent += ListItemClickEvent;
971 listBackgroundImage.Add(list);
972 listBackgroundImage.Hide();
975 private void ListItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e)
977 if (e.ClickedView != null)
979 UpdateSelectedItem(e.ClickedView.AdapterPosition);
981 ItemClickEventArgs args = new ItemClickEventArgs();
982 args.Index = e.ClickedView.AdapterPosition;
983 args.Text = (e.ClickedView.ItemView as DropDownItemView)?.Text;
984 OnClickEvent(this, args);
987 listBackgroundImage.Hide();
990 private void ListItemTouchEvent(object sender, FlexibleView.ItemTouchEventArgs e)
992 PointStateType state = e.Touch.GetState(0);
995 case PointStateType.Down:
996 if (e.TouchedView != null)
998 touchedView = e.TouchedView.ItemView as DropDownItemView;
999 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1001 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
1005 case PointStateType.Motion:
1006 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1008 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
1011 case PointStateType.Up:
1012 if (touchedView != null && touchedView.BackgroundColorSelector != null)
1014 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
1022 private void UpdateSelectedItem(int index)
1024 if (selectedItemIndex != -1)
1026 DropDownItemData data = adapter.GetData(selectedItemIndex);
1029 data.IsSelected = false;
1031 DropDownItemView view = list?.FindViewHolderForAdapterPosition(selectedItemIndex)?.ItemView as DropDownItemView;
1034 view.IsSelected = false;
1040 DropDownItemData data = adapter.GetData(index);
1043 data.IsSelected = true;
1045 DropDownItemView view = list?.FindViewHolderForAdapterPosition(index)?.ItemView as DropDownItemView;
1048 view.IsSelected = true;
1049 button.Text = view.Text;
1053 selectedItemIndex = index;
1056 private void CreateListBackgroundImage()
1058 listBackgroundImage = new ImageView
1060 Name = "ListBackgroundImage",
1061 PositionUsesPivotPoint = true,
1062 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1063 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1064 WidthResizePolicy = ResizePolicyType.FitToChildren,
1065 HeightResizePolicy = ResizePolicyType.FitToChildren,
1067 Add(listBackgroundImage);
1070 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
1072 listBackgroundImage.Show();
1075 private void CreateHeaderTextAttributes()
1077 if (dropDownAttributes.HeaderTextAttributes == null)
1079 dropDownAttributes.HeaderTextAttributes = new TextAttributes()
1081 PositionUsesPivotPoint = true,
1082 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1083 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1084 WidthResizePolicy = ResizePolicyType.FillToParent,
1085 HeightResizePolicy = ResizePolicyType.FillToParent,
1086 HorizontalAlignment = HorizontalAlignment.Center,
1087 VerticalAlignment = VerticalAlignment.Center,
1092 private void CreateButtonAttributes()
1094 if (dropDownAttributes.ButtonAttributes == null)
1096 dropDownAttributes.ButtonAttributes = new ButtonAttributes();
1100 private void CreateButtonTextAttributes()
1102 CreateButtonAttributes();
1104 if (dropDownAttributes.ButtonAttributes.TextAttributes == null)
1106 dropDownAttributes.ButtonAttributes.TextAttributes = new TextAttributes
1108 PositionUsesPivotPoint = true,
1109 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1110 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1111 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1112 HeightResizePolicy = ResizePolicyType.FillToParent,
1113 Position2D = new Position2D(0, 0),
1114 HorizontalAlignment = HorizontalAlignment.Begin,
1115 VerticalAlignment = VerticalAlignment.Center,
1120 private void CreateButtonIconAttributes()
1122 CreateButtonAttributes();
1124 if (dropDownAttributes.ButtonAttributes.IconAttributes == null)
1126 dropDownAttributes.ButtonAttributes.IconAttributes = new ImageAttributes
1128 PositionUsesPivotPoint = true,
1129 ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight,
1130 PivotPoint = Tizen.NUI.PivotPoint.CenterRight,
1135 private void CreateListBackgroundAttributes()
1137 if (dropDownAttributes.ListBackgroundImageAttributes == null)
1139 dropDownAttributes.ListBackgroundImageAttributes = new ImageAttributes
1141 PositionUsesPivotPoint = true,
1142 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1143 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1149 #region ItemClickEventArgs
1151 /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
1153 /// <since_tizen> 6 </since_tizen>
1154 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1155 [EditorBrowsable(EditorBrowsableState.Never)]
1156 public class ItemClickEventArgs : EventArgs
1158 /// <summary> Clicked item index of DropDown's list </summary>
1159 /// <since_tizen> 6 </since_tizen>
1160 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1161 [EditorBrowsable(EditorBrowsableState.Never)]
1163 /// <summary> Clicked item text string of DropDown's list </summary>
1164 /// <since_tizen> 6 </since_tizen>
1165 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1166 [EditorBrowsable(EditorBrowsableState.Never)]
1171 #region DropDownItemData
1173 /// DropDownItemData is a class to record all data which will be applied to DropDown item.
1175 /// <since_tizen> 6 </since_tizen>
1176 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1177 [EditorBrowsable(EditorBrowsableState.Never)]
1178 public class DropDownItemData
1180 private DropDownItemAttributes itemDataAttributes = new DropDownItemAttributes();
1183 /// Creates a new instance of a DropDownItemData.
1185 /// <since_tizen> 6 </since_tizen>
1186 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1187 [EditorBrowsable(EditorBrowsableState.Never)]
1188 public DropDownItemData()
1194 /// Creates a new instance of a DropDownItemData with style.
1196 /// <param name="style">Create DropDownItemData by special style defined in UX.</param>
1197 /// <since_tizen> 6 </since_tizen>
1198 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1199 [EditorBrowsable(EditorBrowsableState.Never)]
1200 public DropDownItemData(string style)
1204 Attributes attributes = StyleManager.Instance.GetAttributes(style);
1205 if(attributes == null)
1207 throw new InvalidOperationException($"There is no style {style}");
1209 itemDataAttributes = attributes as DropDownItemAttributes;
1215 /// Creates a new instance of a DropDownItemData with attributes.
1217 /// <param name="attributes">Create DropDownItemData by attributes customized by user.</param>
1218 /// <since_tizen> 6 </since_tizen>
1219 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1220 [EditorBrowsable(EditorBrowsableState.Never)]
1221 public DropDownItemData(DropDownItemAttributes attributes)
1223 itemDataAttributes = attributes.Clone() as DropDownItemAttributes;
1228 /// DropDown item size.
1230 /// <since_tizen> 6 </since_tizen>
1231 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1232 [EditorBrowsable(EditorBrowsableState.Never)]
1233 public Size2D Size2D
1237 return itemDataAttributes.Size2D;
1241 itemDataAttributes.Size2D = value;
1246 /// DropDown item background color selector.
1248 /// <since_tizen> 6 </since_tizen>
1249 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1250 [EditorBrowsable(EditorBrowsableState.Never)]
1251 public ColorSelector BackgroundColorSelector
1255 return itemDataAttributes.BackgroundColor;
1259 if (itemDataAttributes.BackgroundColor == null)
1261 itemDataAttributes.BackgroundColor = value.Clone() as ColorSelector;
1265 itemDataAttributes.BackgroundColor = value.Clone();
1272 /// DropDown item text string.
1274 /// <since_tizen> 6 </since_tizen>
1275 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1276 [EditorBrowsable(EditorBrowsableState.Never)]
1281 return itemDataAttributes.TextAttributes?.Text?.All;
1285 CreateTextAttributes();
1286 if (itemDataAttributes.TextAttributes.Text == null)
1288 itemDataAttributes.TextAttributes.Text = new StringSelector { All = value };
1292 itemDataAttributes.TextAttributes.Text.All = value;
1298 /// DropDown item text's point size.
1300 /// <since_tizen> 6 </since_tizen>
1301 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1302 [EditorBrowsable(EditorBrowsableState.Never)]
1303 public float PointSize
1307 return itemDataAttributes.TextAttributes?.PointSize?.All ?? 0;
1311 CreateTextAttributes();
1312 if (itemDataAttributes.TextAttributes.PointSize == null)
1314 itemDataAttributes.TextAttributes.PointSize = new FloatSelector { All = value };
1318 itemDataAttributes.TextAttributes.PointSize.All = value;
1324 /// DropDown item text's font family.
1326 /// <since_tizen> 6 </since_tizen>
1327 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1328 [EditorBrowsable(EditorBrowsableState.Never)]
1329 public string FontFamily
1333 return itemDataAttributes.TextAttributes?.FontFamily;
1337 CreateTextAttributes();
1338 itemDataAttributes.TextAttributes.FontFamily = value;
1343 /// DropDown item text's position.
1345 /// <since_tizen> 6 </since_tizen>
1346 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1347 [EditorBrowsable(EditorBrowsableState.Never)]
1348 public Position2D TextPosition2D
1352 return itemDataAttributes.TextAttributes?.Position2D;
1356 CreateTextAttributes();
1357 itemDataAttributes.TextAttributes.Position2D = value;
1362 /// DropDown item's icon's resource url.
1364 /// <since_tizen> 6 </since_tizen>
1365 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1366 [EditorBrowsable(EditorBrowsableState.Never)]
1367 public string IconResourceUrl
1371 return itemDataAttributes.IconAttributes?.ResourceURL?.All;
1375 CreateIconAttributes();
1376 if (itemDataAttributes.IconAttributes.ResourceURL == null)
1378 itemDataAttributes.IconAttributes.ResourceURL = new StringSelector { All = value };
1382 itemDataAttributes.IconAttributes.ResourceURL.All = value;
1388 /// DropDown item's icon's size.
1390 /// <since_tizen> 6 </since_tizen>
1391 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1392 [EditorBrowsable(EditorBrowsableState.Never)]
1393 public Size2D IconSize2D
1397 return itemDataAttributes.IconAttributes?.Size2D;
1401 CreateIconAttributes();
1402 itemDataAttributes.IconAttributes.Size2D = value;
1407 /// DropDown item's icon's position.
1409 /// <since_tizen> 6 </since_tizen>
1410 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1411 [EditorBrowsable(EditorBrowsableState.Never)]
1412 public Position2D IconPosition2D
1416 return itemDataAttributes.IconAttributes.Position2D;
1420 CreateIconAttributes();
1421 itemDataAttributes.IconAttributes.Position2D = value;
1426 /// DropDown item's check image's resource url.
1428 /// <since_tizen> 6 </since_tizen>
1429 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1430 [EditorBrowsable(EditorBrowsableState.Never)]
1431 public string CheckImageResourceUrl
1435 return itemDataAttributes.CheckImageAttributes?.ResourceURL?.All;
1439 CreateCheckImageAttributes();
1440 if (itemDataAttributes.CheckImageAttributes.ResourceURL == null)
1442 itemDataAttributes.CheckImageAttributes.ResourceURL = new StringSelector { All = value };
1446 itemDataAttributes.CheckImageAttributes.ResourceURL.All = value;
1452 /// DropDown item's check image's size.
1454 /// <since_tizen> 6 </since_tizen>
1455 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1456 [EditorBrowsable(EditorBrowsableState.Never)]
1457 public Size2D CheckImageSize2D
1461 return itemDataAttributes.CheckImageAttributes?.Size2D;
1465 CreateCheckImageAttributes();
1466 itemDataAttributes.CheckImageAttributes.Size2D = value;
1471 /// DropDown item's check image's right space.
1473 /// <since_tizen> 6 </since_tizen>
1474 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1475 [EditorBrowsable(EditorBrowsableState.Never)]
1476 public int CheckImageRightSpace
1480 return itemDataAttributes.CheckImageRightSpace;
1484 itemDataAttributes.CheckImageRightSpace = value;
1489 /// Flag to decide DropDown item is selected or not.
1491 /// <since_tizen> 6 </since_tizen>
1492 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1493 [EditorBrowsable(EditorBrowsableState.Never)]
1494 public bool IsSelected
1498 return itemDataAttributes.IsSelected;
1502 itemDataAttributes.IsSelected = value;
1506 private void Initalize()
1508 if (itemDataAttributes == null)
1510 throw new Exception("Button attribute parse error.");
1514 private void CreateTextAttributes()
1516 if(itemDataAttributes.TextAttributes == null)
1518 itemDataAttributes.TextAttributes = new TextAttributes
1520 PositionUsesPivotPoint = true,
1521 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1522 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1523 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1524 HeightResizePolicy = ResizePolicyType.FillToParent,
1525 VerticalAlignment = VerticalAlignment.Center,
1526 HorizontalAlignment = HorizontalAlignment.Begin,
1531 private void CreateIconAttributes()
1533 if (itemDataAttributes.IconAttributes == null)
1535 itemDataAttributes.IconAttributes = new ImageAttributes
1537 PositionUsesPivotPoint = true,
1538 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1539 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1544 private void CreateCheckImageAttributes()
1546 if (itemDataAttributes.CheckImageAttributes == null)
1548 itemDataAttributes.CheckImageAttributes = new ImageAttributes
1550 PositionUsesPivotPoint = true,
1551 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1552 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1559 #region DropDownItemView
1560 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1561 [EditorBrowsable(EditorBrowsableState.Never)]
1562 internal class DropDownItemView : Control
1564 private TextLabel mText = null;
1565 private ImageView mIcon = null;
1566 private ImageView mCheck = null;
1568 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1569 [EditorBrowsable(EditorBrowsableState.Never)]
1570 public DropDownItemView() : base()
1574 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1575 [EditorBrowsable(EditorBrowsableState.Never)]
1576 public ColorSelector BackgroundColorSelector
1582 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1583 [EditorBrowsable(EditorBrowsableState.Never)]
1601 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1602 [EditorBrowsable(EditorBrowsableState.Never)]
1603 public string FontFamily
1611 return mText.FontFamily;
1616 mText.FontFamily = value;
1620 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1621 [EditorBrowsable(EditorBrowsableState.Never)]
1622 public float PointSize
1630 return mText.PointSize;
1635 mText.PointSize = value;
1639 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1640 [EditorBrowsable(EditorBrowsableState.Never)]
1641 public Color TextColor
1649 return mText.TextColor;
1654 mText.TextColor = value;
1658 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1659 [EditorBrowsable(EditorBrowsableState.Never)]
1660 public Position2D TextPosition2D
1668 return mText.Position2D;
1673 mText.Position2D = value;
1677 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1678 [EditorBrowsable(EditorBrowsableState.Never)]
1679 public string IconResourceUrl
1687 return mIcon.ResourceUrl;
1692 mIcon.ResourceUrl = value;
1696 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1697 [EditorBrowsable(EditorBrowsableState.Never)]
1698 public Size2D IconSize2D
1706 return mIcon.Size2D;
1711 mIcon.Size2D = value;
1715 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1716 [EditorBrowsable(EditorBrowsableState.Never)]
1717 public Position2D IconPosition2D
1725 return mIcon.Position2D;
1730 mIcon.Position2D = value;
1734 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1735 [EditorBrowsable(EditorBrowsableState.Never)]
1736 public string CheckResourceUrl
1744 return mCheck.ResourceUrl;
1749 mCheck.ResourceUrl = value;
1753 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1754 [EditorBrowsable(EditorBrowsableState.Never)]
1755 public Position2D CheckPosition2D
1763 return mCheck.Position2D;
1768 mCheck.Position2D = value;
1772 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1773 [EditorBrowsable(EditorBrowsableState.Never)]
1774 public Size2D CheckImageSize2D
1782 return mCheck.Size2D;
1787 mCheck.Size2D = value;
1791 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1792 [EditorBrowsable(EditorBrowsableState.Never)]
1793 public bool IsSelected
1801 return mCheck.Visibility;
1817 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1818 [EditorBrowsable(EditorBrowsableState.Never)]
1819 protected override void Dispose(DisposeTypes type)
1826 if (type == DisposeTypes.Explicit)
1852 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1853 [EditorBrowsable(EditorBrowsableState.Never)]
1854 protected override Attributes GetAttributes()
1859 private void CreateIcon()
1863 mIcon = new ImageView()
1865 PositionUsesPivotPoint = true,
1866 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1867 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1873 private void CreateText()
1877 mText = new TextLabel()
1879 PositionUsesPivotPoint = true,
1880 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1881 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1882 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1883 HeightResizePolicy = ResizePolicyType.FillToParent,
1884 VerticalAlignment = VerticalAlignment.Center,
1885 HorizontalAlignment = HorizontalAlignment.Begin,
1891 private void CreateCheckImage()
1895 mCheck = new ImageView()
1897 PositionUsesPivotPoint = true,
1898 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1899 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1908 #region DropDownListBridge
1911 /// DropDownListBridge is bridge to contact item data and item view.
1913 /// <since_tizen> 6 </since_tizen>
1914 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1915 [EditorBrowsable(EditorBrowsableState.Never)]
1916 public class DropDownListBridge : FlexibleView.Adapter
1918 private List<DropDownItemData> mDatas = new List<DropDownItemData>();
1921 /// Creates a new instance of a DropDownListBridge.
1923 /// <since_tizen> 6 </since_tizen>
1924 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1925 [EditorBrowsable(EditorBrowsableState.Never)]
1926 public DropDownListBridge()
1931 /// Insert data. The inserted data will be added to the special position by index automatically.
1933 /// <param name="position">Position index where will be inserted.</param>
1934 /// <param name="data">Item data which will apply to tab item view.</param>
1935 /// <since_tizen> 6 </since_tizen>
1936 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1937 [EditorBrowsable(EditorBrowsableState.Never)]
1938 public void InsertData(int position, DropDownItemData data)
1942 position = mDatas.Count;
1944 mDatas.Insert(position, data);
1945 NotifyItemInserted(position);
1949 /// Remove data by position.
1951 /// <param name="position">Position index where will be removed.</param>
1952 /// <since_tizen> 6 </since_tizen>
1953 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1954 [EditorBrowsable(EditorBrowsableState.Never)]
1955 public void RemoveData(int position)
1957 mDatas.RemoveAt(position);
1958 NotifyItemRemoved(position);
1962 /// Get data by position.
1964 /// <param name="position">Position index where will be gotten.</param>
1965 /// <since_tizen> 6 </since_tizen>
1966 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1967 [EditorBrowsable(EditorBrowsableState.Never)]
1968 public DropDownItemData GetData(int position)
1970 return mDatas[position];
1974 /// Get view holder by view type.
1976 /// <param name="viewType">Create item view.</param>
1977 /// <since_tizen> 6 </since_tizen>
1978 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1979 [EditorBrowsable(EditorBrowsableState.Never)]
1980 public override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
1982 FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new DropDownItemView());
1988 /// Binder view holder, it can be override.
1990 /// <param name="holder">View holder.</param>
1991 /// <param name="position">Position index where will be gotten.</param>
1992 /// <since_tizen> 6 </since_tizen>
1993 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1994 [EditorBrowsable(EditorBrowsableState.Never)]
1995 public override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position)
1997 DropDownItemData listItemData = mDatas[position];
1998 if(listItemData == null)
2002 DropDownItemView listItemView = holder.ItemView as DropDownItemView;
2003 listItemView.Name = "Item" + position;
2004 if (listItemData.Size2D != null)
2006 holder.ItemView.Size2D = listItemData.Size2D;
2009 if (listItemView != null)
2011 listItemView.BackgroundColorSelector = listItemData.BackgroundColorSelector;
2012 if (listItemData.Text != null)
2014 listItemView.Text = listItemData.Text;
2015 listItemView.PointSize = listItemData.PointSize;
2016 listItemView.FontFamily = listItemData.FontFamily;
2017 listItemView.TextPosition2D = listItemData.TextPosition2D;
2020 if (listItemData.IconResourceUrl != null)
2022 listItemView.IconResourceUrl = listItemData.IconResourceUrl;
2023 listItemView.IconSize2D = listItemData.IconSize2D;
2024 if (listItemView.IconSize2D != null)
2026 listItemView.IconPosition2D = new Position2D(listItemData.IconPosition2D.X, (listItemView.Size2D.Height - listItemView.IconSize2D.Height) / 2);
2030 if (listItemData.CheckImageResourceUrl != null)
2032 listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
2033 listItemView.CheckImageSize2D = listItemData.CheckImageSize2D;
2034 if (listItemView.CheckImageSize2D != null)
2036 listItemView.CheckPosition2D = new Position2D(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize2D.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize2D.Height) / 2);
2040 listItemView.IsSelected = listItemData.IsSelected;
2045 /// Destroy view holder, it can be override.
2047 /// <param name="holder">View holder.</param>
2048 /// <since_tizen> 6 </since_tizen>
2049 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2050 [EditorBrowsable(EditorBrowsableState.Never)]
2051 public override void OnDestroyViewHolder(FlexibleView.ViewHolder holder)
2053 if (holder.ItemView != null)
2055 holder.ItemView.Dispose();
2060 /// Get item count, it can be override.
2062 /// <since_tizen> 6 </since_tizen>
2063 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2064 [EditorBrowsable(EditorBrowsableState.Never)]
2065 public override int GetItemCount()
2067 return mDatas.Count;