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;
21 using Tizen.NUI.Binding;
23 namespace Tizen.NUI.Components
26 /// DropDown is one kind of common component, a dropdown allows the user click dropdown button to choose one value from a list.
28 /// <since_tizen> 6 </since_tizen>
29 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public class DropDown : Control
33 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public static readonly BindableProperty ListPaddingProperty = BindableProperty.Create("ListPadding", typeof(Extents), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
37 var instance = (Tizen.NUI.Components.DropDown)bindable;
40 instance.privateListPadding = (Extents)newValue;
43 defaultValueCreator: (bindable) =>
45 var instance = (Tizen.NUI.Components.DropDown)bindable;
46 return instance.privateListPadding;
48 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
49 [EditorBrowsable(EditorBrowsableState.Never)]
50 public static readonly BindableProperty ListSizeProperty = BindableProperty.Create("ListSize", typeof(Size), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
52 var instance = (Tizen.NUI.Components.DropDown)bindable;
55 instance.privateListSize = (Size)newValue;
58 defaultValueCreator: (bindable) =>
60 var instance = (Tizen.NUI.Components.DropDown)bindable;
61 return instance.privateListSize;
63 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create("SelectedItemIndex", typeof(int), typeof(Tizen.NUI.Components.DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
67 var instance = (Tizen.NUI.Components.DropDown)bindable;
70 instance.privateSelectedItemIndex = (int)newValue;
73 defaultValueCreator: (bindable) =>
75 var instance = (Tizen.NUI.Components.DropDown)bindable;
76 return instance.privateSelectedItemIndex;
78 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public static readonly BindableProperty FocusedItemIndexProperty = BindableProperty.Create("FocusedItemIndex", typeof(int), typeof(Tizen.NUI.Components.DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
82 var instance = (Tizen.NUI.Components.DropDown)bindable;
85 instance.privateFocusedItemIndex = (int)newValue;
88 defaultValueCreator: (bindable) =>
90 var instance = (Tizen.NUI.Components.DropDown)bindable;
91 return instance.privateFocusedItemIndex;
93 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
94 [EditorBrowsable(EditorBrowsableState.Never)]
95 public static readonly BindableProperty ListMarginProperty = BindableProperty.Create("ListMargin", typeof(Extents), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
97 var instance = (Tizen.NUI.Components.DropDown)bindable;
100 instance.privateListMargin = (Extents)newValue;
103 defaultValueCreator: (bindable) =>
105 var instance = (Tizen.NUI.Components.DropDown)bindable;
106 return instance.privateListMargin;
108 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
109 [EditorBrowsable(EditorBrowsableState.Never)]
110 public static readonly BindableProperty ListRelativeOrientationProperty = BindableProperty.Create("ListRelativeOrientation", typeof(ListOrientation), typeof(Tizen.NUI.Components.DropDown), ListOrientation.Left, propertyChanged: (bindable, oldValue, newValue) =>
112 var instance = (Tizen.NUI.Components.DropDown)bindable;
113 if (newValue != null)
115 instance.privateListRelativeOrientation = (ListOrientation)newValue;
118 defaultValueCreator: (bindable) =>
120 var instance = (Tizen.NUI.Components.DropDown)bindable;
121 return instance.privateListRelativeOrientation;
123 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 public static readonly BindableProperty SpaceProperty = BindableProperty.Create("Space", typeof(Extents), typeof(Tizen.NUI.Components.DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
127 var instance = (Tizen.NUI.Components.DropDown)bindable;
128 if (newValue != null)
130 instance.privateSpace = (Extents)newValue;
133 defaultValueCreator: (bindable) =>
135 var instance = (Tizen.NUI.Components.DropDown)bindable;
136 return instance.privateSpace;
138 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
139 [EditorBrowsable(EditorBrowsableState.Never)]
140 public static readonly BindableProperty SpaceBetweenButtonTextAndIconProperty = BindableProperty.Create("SpaceBetweenButtonTextAndIcon", typeof(int), typeof(Tizen.NUI.Components.DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
142 var instance = (Tizen.NUI.Components.DropDown)bindable;
143 if (newValue != null)
145 instance.privateSpaceBetweenButtonTextAndIcon = (int)newValue;
148 defaultValueCreator: (bindable) =>
150 var instance = (Tizen.NUI.Components.DropDown)bindable;
151 return instance.privateSpaceBetweenButtonTextAndIcon;
156 private Button button = null;
157 private TextLabel headerText = null;
158 private TextLabel buttonText = null;
159 private ImageView listBackgroundImage = null;
161 // Component that scrolls the child added to it.
162 private LayoutScroller layoutScroller = null;
164 // The LinearLayout container to house the items in the drop down list.
165 private View dropDownMenuFullList = null;
167 private DropDownListBridge adapter = new DropDownListBridge();
168 private int selectedItemIndex = -1;
170 private Extents listPadding = null;
171 DropDownItemView selectedItemView = null;
173 private bool itemPressed = false;
175 private TapGestureDetector tapGestureDetector = null;
177 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public new DropDownStyle Style => ViewStyle as DropDownStyle;
182 /// Creates a new instance of a DropDown.
184 /// <since_tizen> 6 </since_tizen>
185 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
186 [EditorBrowsable(EditorBrowsableState.Never)]
187 public DropDown() : base()
192 /// Creates a new instance of a DropDown with style.
194 /// <param name="style">Create DropDown by special style defined in UX.</param>
195 /// <since_tizen> 6 </since_tizen>
196 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public DropDown(string style) : base(style)
203 /// Creates a new instance of a DropDown with attributes.
205 /// <param name="attributes">Create DropDown by attributes customized by user.</param>
206 /// <since_tizen> 6 </since_tizen>
207 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public DropDown(DropDownStyle attributes) : base(attributes)
214 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
216 /// <since_tizen> 6 </since_tizen>
217 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public delegate void ClickEventHandler<ClickEventArgs>(object sender, ClickEventArgs e);
222 /// An event for the item clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
224 /// <since_tizen> 6 </since_tizen>
225 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 public event ClickEventHandler<ItemClickEventArgs> ItemClickEvent;
230 /// List position in relation to the main button.
232 /// <since_tizen> 6 </since_tizen>
233 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
234 [EditorBrowsable(EditorBrowsableState.Never)]
235 public enum ListOrientation
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)]
247 /// <since_tizen> 6 </since_tizen>
248 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
249 [EditorBrowsable(EditorBrowsableState.Never)]
254 /// Space between button text and button icon in DropDown.
256 /// <since_tizen> 6 </since_tizen>
257 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
258 public int SpaceBetweenButtonTextAndIcon
262 return (int)GetValue(SpaceBetweenButtonTextAndIconProperty);
266 SetValue(SpaceBetweenButtonTextAndIconProperty, value);
269 private int privateSpaceBetweenButtonTextAndIcon
273 return (int)Style.SpaceBetweenButtonTextAndIcon;
277 Style.SpaceBetweenButtonTextAndIcon = value;
283 /// Left space in DropDown.
285 /// <since_tizen> 6 </since_tizen>
286 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
291 return (Extents)GetValue(SpaceProperty);
295 SetValue(SpaceProperty, value);
298 private Extents privateSpace
302 return (Extents)Style.Space;
312 /// List relative orientation in DropDown.
314 /// <since_tizen> 6 </since_tizen>
315 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
316 public ListOrientation ListRelativeOrientation
320 return (ListOrientation)GetValue(ListRelativeOrientationProperty);
324 SetValue(ListRelativeOrientationProperty, value);
328 private ListOrientation privateListRelativeOrientation
332 return (ListOrientation)Style.ListRelativeOrientation;
336 Style.ListRelativeOrientation = value;
344 /// <since_tizen> 6 </since_tizen>
345 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
346 public Extents ListMargin
350 return (Extents)GetValue(ListMarginProperty);
354 SetValue(ListMarginProperty, value);
357 private Extents privateListMargin
361 return Style.ListMargin;
365 Style.ListMargin = value;
371 /// Focused item index in list.
373 /// <since_tizen> 6 </since_tizen>
374 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
375 public int FocusedItemIndex
379 return (int)GetValue(FocusedItemIndexProperty);
383 SetValue(FocusedItemIndexProperty, value);
386 private int privateFocusedItemIndex
390 return (int)Style.FocusedItemIndex;
394 Style.FocusedItemIndex = value;
400 /// Selected item index in list.
402 /// <since_tizen> 6 </since_tizen>
403 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
404 public int SelectedItemIndex
408 return (int)GetValue(SelectedItemIndexProperty);
412 if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount())
417 SetValue(SelectedItemIndexProperty, value); // UpdatesSelectedItem
420 private int privateSelectedItemIndex
424 return selectedItemIndex;
428 if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount())
432 UpdateSelectedItem(value);
437 /// List size in DropDown.
439 /// <since_tizen> 6 </since_tizen>
440 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
445 return (Size)GetValue(ListSizeProperty);
449 SetValue(ListSizeProperty, value);
452 private Size privateListSize
456 return Style.ListSize;
460 Style.ListSize = value;
466 /// List padding in DropDown.
468 /// <since_tizen> 6 </since_tizen>
469 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
470 public Extents ListPadding
474 return (Extents)GetValue(ListPaddingProperty);
478 SetValue(ListPaddingProperty, value);
481 private Extents privateListPadding
489 Style.ListPadding.CopyFrom(value);
491 if (null == listPadding)
493 listPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
495 Style.ListPadding.Start = start;
496 Style.ListPadding.End = end;
497 Style.ListPadding.Top = top;
498 Style.ListPadding.Bottom = bottom;
500 }, value.Start, value.End, value.Top, value.Bottom);
504 listPadding.CopyFrom(value);
512 /// Add list item by item data. The added item will be added to end of all items automatically.
514 /// <param name="itemData">Item data which will apply to tab item view.</param>
515 /// <since_tizen> 6 </since_tizen>
516 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
517 [EditorBrowsable(EditorBrowsableState.Never)]
518 public void AddItem(DropDownDataItem itemData)
520 // Add item to adaptor, will be added to list via AddItemAt during OnUpdate()
521 int insertionPosition = adapter.GetItemCount();
522 adapter.InsertData(insertionPosition, itemData);
526 /// Delete list item by index.
528 /// <param name="index">Position index where will be deleted.</param>
529 /// <since_tizen> 6 </since_tizen>
530 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
531 [EditorBrowsable(EditorBrowsableState.Never)]
532 public void DeleteItem(int index)
534 if(index < 0 || index >= adapter.GetItemCount())
539 if (selectedItemIndex == index)
541 selectedItemIndex = -1;
543 else if(selectedItemIndex > index)
548 adapter.RemoveData(index);
550 if(index < dropDownMenuFullList.ChildCount)
552 View childToRemove = dropDownMenuFullList.GetChildAt((uint)index);
555 childToRemove.TouchEvent -= ListItemTouchEvent;
556 dropDownMenuFullList.Remove(childToRemove);
557 dropDownMenuFullList?.Layout?.RequestLayout();
563 /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
565 /// <param name="item">Item data which will apply to tab item view.</param>
566 /// <param name="index">Position index where will be inserted.</param>
567 /// <since_tizen> 6 </since_tizen>
568 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public void InsertItem(DropDownDataItem item, int index)
572 if (index < 0 || index >= adapter.GetItemCount())
577 if (selectedItemIndex >= index)
582 adapter.InsertData(index, item);
586 /// Add scroll bar to list.
588 /// <param name="scrollBar">Scroll bar defined by user which will be added to list.</param>
589 /// <since_tizen> 6 </since_tizen>
590 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
591 [EditorBrowsable(EditorBrowsableState.Never)]
592 public void AttachScrollBar(ScrollBar scrollBar)
594 if (layoutScroller == null)
598 Tizen.Log.Error("DropDown","Feature unsupported");
602 /// Detach scroll bar to list.
604 /// <since_tizen> 6 </since_tizen>
605 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
606 [EditorBrowsable(EditorBrowsableState.Never)]
607 public void DetachScrollBar()
609 if (layoutScroller == null)
613 Tizen.Log.Error("DropDown","Feature unsupported");
616 protected override void RegisterDetectionOfSubstyleChanges()
618 base.RegisterDetectionOfSubstyleChanges();
620 Style.PropertyChanged += DropDownAttributesPropertyChanged;
621 Style.HeaderText.PropertyChanged += HeaderTextAttributesPropertyChanged;
622 Style.Button.PropertyChanged += ButtonAttributesPropertyChanged;
624 Style.Button.Icon.PropertyChanged += IconStylePropertyChanged;;
627 private void IconStylePropertyChanged(object sender, PropertyChangedEventArgs e)
630 int buttonTextWidth = 0;
631 if (e.PropertyName.Equals(ImageViewStyle.SizeProperty.PropertyName))
633 iconWidth = (int)Style.Button.Icon.Size.Width;
636 if (buttonText.NaturalSize2D != null)
638 buttonTextWidth = buttonText.NaturalSize2D.Width;
641 button.SizeWidth = iconWidth + (int)Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
644 private void DropDownAttributesPropertyChanged(object sender, PropertyChangedEventArgs e)
646 if (e.PropertyName.Equals("Space"))
648 button.Position2D.X = (int)Style.Space.Start;
652 private void ButtonAttributesPropertyChanged(object sender, PropertyChangedEventArgs e)
656 button = new Button()
658 PositionUsesPivotPoint = true,
659 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
660 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
661 HeightResizePolicy = ResizePolicyType.FillToParent,
662 IconRelativeOrientation = Components.Button.IconOrientation.Right,
664 button.Name = "DropDownButton";
665 button.ClickEvent += ButtonClickEvent;
668 button.ApplyStyle(Style.Button);
671 if (null == buttonText)
673 buttonText = new TextLabel()
675 PositionUsesPivotPoint = true,
676 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
677 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
678 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
679 HeightResizePolicy = ResizePolicyType.FillToParent,
681 buttonText.Name = "DropDownButtonText";
687 private void HeaderTextAttributesPropertyChanged(object sender, PropertyChangedEventArgs e)
689 if (null == headerText)
691 headerText = new TextLabel();
692 headerText.Name = "DropDownHeaderText";
695 headerText.ApplyStyle(Style.HeaderText);
700 /// Update DropDown by attributes.
702 /// <since_tizen> 6 </since_tizen>
703 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
704 [EditorBrowsable(EditorBrowsableState.Never)]
705 protected override void OnUpdate()
707 if (Style.ListBackgroundImage != null)
709 if (listBackgroundImage == null)
711 CreateListBackgroundImage();
714 int temp = (int)Style.FocusedItemIndex;
716 if (layoutScroller==null) // layoutScroller used to test of ListContainer Setup invoked already
718 SetUpListContainer();
721 listBackgroundImage.Size = Style.ListSize;
723 // Resize and position scrolling list within the drop down list container. Can be used to position list in relation to the background image.
724 layoutScroller.Size = Style.ListSize - new Size((Style.ListPadding.Start + Style.ListPadding.End), (Style.ListPadding.Top + Style.ListPadding.Bottom), 0 );
725 layoutScroller.Position2D = new Position2D(Style.ListPadding.Start,Style.ListPadding.Top);
727 int listBackgroundImageX = 0;
728 int listBackgroundImageY = 0;
729 if (Style.ListRelativeOrientation == ListOrientation.Left)
731 if (Style.ListMargin != null)
733 listBackgroundImageX = (int)Style.ListMargin.Start;
734 listBackgroundImageY = (int)Style.ListMargin.Top;
737 else if (Style.ListRelativeOrientation == ListOrientation.Right)
739 if (Style.ListMargin != null)
742 if (dropDownMenuFullList.Size2D != null)
744 listWidth = dropDownMenuFullList.Size2D.Width;
746 listBackgroundImageX = Size2D.Width - listWidth - (int)Style.ListMargin.End;
747 listBackgroundImageY = (int)Style.ListMargin.Top;
750 listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
751 dropDownMenuFullList?.Layout?.RequestLayout();
753 int numberOfItemsToAdd = adapter.GetItemCount();
755 if (adapter.AdapterPurge == true)
757 adapter.AdapterPurge = false;
758 for (int i =0; i<numberOfItemsToAdd; i++)
760 AddItemAt(adapter.GetData(i), i);
764 // Set selection icon on View
765 UpdateSelectedItem(selectedItemIndex);
770 /// Dispose DropDown and all children on it.
772 /// <param name="type">Dispose type.</param>
773 /// <since_tizen> 6 </since_tizen>
774 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
775 [EditorBrowsable(EditorBrowsableState.Never)]
776 protected override void Dispose(DisposeTypes type)
783 if (type == DisposeTypes.Explicit)
785 if (headerText != null)
787 Utility.Dispose(headerText);
790 if (buttonText != null)
792 Utility.Dispose(buttonText);
797 Utility.Dispose(button);
800 if (layoutScroller != null)
802 if (dropDownMenuFullList != null)
804 Utility.Dispose(dropDownMenuFullList);
807 if (listBackgroundImage != null)
809 Utility.Dispose(listBackgroundImage);
812 Utility.Dispose(layoutScroller);
820 /// Get DropDown attribues.
822 /// <since_tizen> 6 </since_tizen>
823 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
824 [EditorBrowsable(EditorBrowsableState.Never)]
825 protected override ViewStyle GetViewStyle()
827 return new DropDownStyle();
830 private void AddItemAt(DropDownDataItem itemData,int index)
832 ViewHolder viewHolder = adapter.OnCreateViewHolder();
833 if (!viewHolder.IsBound)
835 adapter.BindViewHolder(viewHolder, index);
836 viewHolder.IsBound = true;
839 if (tapGestureDetector == null)
841 tapGestureDetector = new TapGestureDetector();
843 View view = viewHolder.ItemView;
844 view.TouchEvent += ListItemTouchEvent;
845 dropDownMenuFullList.Add(view);
848 private void OnClickEvent(object sender, ItemClickEventArgs e)
850 ItemClickEvent?.Invoke(sender, e);
852 private void CreateHeaderText()
854 headerText = new TextLabel();
855 headerText.Name = "DropDownHeaderText";
859 private void SetUpListContainer()
861 LinearLayout linear = new LinearLayout()
863 LinearOrientation = LinearLayout.Orientation.Vertical,
866 dropDownMenuFullList = new View()
869 Name = "DropDownMenuList",
870 WidthSpecification = LayoutParamPolicies.MatchParent,
871 HeightSpecification = LayoutParamPolicies.WrapContent,
875 layoutScroller = new LayoutScroller()
877 Name = "LayoutScroller",
879 layoutScroller.AddLayoutToScroll(dropDownMenuFullList);
881 listBackgroundImage.Add(layoutScroller);
882 listBackgroundImage.Hide();
885 private View GetViewFromIndex(uint index)
887 if ((index < dropDownMenuFullList.ChildCount) && (index >=0) )
889 return dropDownMenuFullList.GetChildAt(index);
897 private void SetListItemToSelected(DropDownItemView targetItemView)
899 // Set the DropDownItemView matching the targetItemView to selected.
900 if (selectedItemView!=targetItemView)
902 if (selectedItemView!=null)
904 // clear selection status of currently selected item view
905 selectedItemView.IsSelected = false;
907 // Set target item to selected
908 targetItemView.IsSelected = true;
909 selectedItemView = targetItemView;
913 private bool ListItemTouchEvent(object sender, TouchEventArgs e)
915 PointStateType state = e.Touch.GetState(0);
916 DropDownItemView touchedView = sender as DropDownItemView;;
919 case PointStateType.Down:
920 if (touchedView != null && touchedView.BackgroundColorSelector != null)
922 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
924 itemPressed = true; // if matched with a Up then a click event.
926 case PointStateType.Motion:
927 if (touchedView != null && touchedView.BackgroundColorSelector != null)
929 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
933 case PointStateType.Up:
934 if (touchedView != null && touchedView.BackgroundColorSelector != null)
936 touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
938 if (itemPressed) // if Down was previously sent without motion (Scrolling) in-between then a clicked event occurred.
941 Console.WriteLine("Tapped{0}", touchedView.Name);
942 SetListItemToSelected(touchedView);
943 button.Text = touchedView.Text;
945 listBackgroundImage.Hide();
955 private void UpdateSelectedItem(int index)
957 if (selectedItemIndex != -1)
959 DropDownDataItem data = adapter.GetData(selectedItemIndex);
962 data.IsSelected = false;
964 DropDownItemView listItemView = dropDownMenuFullList.GetChildAt((uint)selectedItemIndex) as DropDownItemView;
965 data.IsSelected = false;
966 SetListItemToSelected(listItemView);
971 DropDownDataItem data = adapter.GetData(index);
974 data.IsSelected = true;
975 DropDownItemView listItemView = dropDownMenuFullList?.GetChildAt((uint)index) as DropDownItemView;
978 SetListItemToSelected(listItemView);
983 selectedItemIndex = index;
984 dropDownMenuFullList?.Layout?.RequestLayout();
987 private void CreateListBackgroundImage()
989 if (null == listBackgroundImage)
991 listBackgroundImage = new ImageView
993 Name = "ListBackgroundImage",
994 PositionUsesPivotPoint = true,
995 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
996 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
997 WidthResizePolicy = ResizePolicyType.FitToChildren,
998 HeightResizePolicy = ResizePolicyType.FitToChildren,
1000 Add(listBackgroundImage);
1004 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
1007 listBackgroundImage.Show();
1008 dropDownMenuFullList?.Layout?.RequestLayout();
1009 listBackgroundImage.RaiseToTop();
1012 private void CreateHeaderTextAttributes()
1014 if (Style.HeaderText == null)
1016 Style.HeaderText = new TextLabelStyle()
1018 PositionUsesPivotPoint = true,
1019 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1020 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1021 WidthResizePolicy = ResizePolicyType.FillToParent,
1022 HeightResizePolicy = ResizePolicyType.FillToParent,
1023 HorizontalAlignment = HorizontalAlignment.Center,
1024 VerticalAlignment = VerticalAlignment.Center,
1029 private void CreateButtonAttributes()
1031 if (Style.Button == null)
1033 Style.Button = new ButtonStyle();
1037 private void CreateButtonTextAttributes()
1039 CreateButtonAttributes();
1041 if (Style.Button.Text== null)
1043 Style.Button.Text= new TextLabelStyle
1045 PositionUsesPivotPoint = true,
1046 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1047 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1048 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1049 HeightResizePolicy = ResizePolicyType.FillToParent,
1050 Position = new Position(0, 0),
1051 HorizontalAlignment = HorizontalAlignment.Begin,
1052 VerticalAlignment = VerticalAlignment.Center,
1057 private void CreateButtonIconAttributes()
1059 CreateButtonAttributes();
1061 if (Style.Button.Icon== null)
1063 Style.Button.Icon= new ImageViewStyle
1065 PositionUsesPivotPoint = true,
1066 ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight,
1067 PivotPoint = Tizen.NUI.PivotPoint.CenterRight,
1072 private void CreateListBackgroundAttributes()
1074 if (Style.ListBackgroundImage == null)
1076 Style.ListBackgroundImage = new ImageViewStyle
1078 PositionUsesPivotPoint = true,
1079 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1080 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1086 #region ItemClickEventArgs
1088 /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
1090 /// <since_tizen> 6 </since_tizen>
1091 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1092 [EditorBrowsable(EditorBrowsableState.Never)]
1093 public class ItemClickEventArgs : EventArgs
1095 /// <summary> Clicked item index of DropDown's list </summary>
1096 /// <since_tizen> 6 </since_tizen>
1097 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1098 [EditorBrowsable(EditorBrowsableState.Never)]
1100 /// <summary> Clicked item text string of DropDown's list </summary>
1101 /// <since_tizen> 6 </since_tizen>
1102 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1103 [EditorBrowsable(EditorBrowsableState.Never)]
1108 #region DropDownDataItem
1110 /// DropDownDataItem is a class to record all data which will be applied to DropDown item.
1112 /// <since_tizen> 6 </since_tizen>
1113 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1114 //[EditorBrowsable(EditorBrowsableState.Never)]
1115 public class DropDownDataItem
1117 private DropDownItemStyle itemDataStyle = new DropDownItemStyle();
1120 /// Creates a new instance of a DropDownItemData.
1122 /// <since_tizen> 6 </since_tizen>
1123 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1124 [EditorBrowsable(EditorBrowsableState.Never)]
1125 public DropDownDataItem()
1131 /// Creates a new instance of a DropDownItemData with style.
1133 /// <param name="style">Create DropDownItemData by special style defined in UX.</param>
1134 /// <since_tizen> 6 </since_tizen>
1135 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1136 [EditorBrowsable(EditorBrowsableState.Never)]
1137 public DropDownDataItem(string style)
1141 ViewStyle attributes = StyleManager.Instance.GetAttributes(style);
1142 if(attributes == null)
1144 throw new InvalidOperationException($"There is no style {style}");
1146 itemDataStyle = attributes as DropDownItemStyle;
1152 /// Creates a new instance of a DropDownItemData with style.
1154 /// <param name="style">Create DropDownItemData by style customized by user.</param>
1155 /// <since_tizen> 6 </since_tizen>
1156 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1157 [EditorBrowsable(EditorBrowsableState.Never)]
1158 public DropDownDataItem(DropDownItemStyle style)
1160 itemDataStyle.CopyFrom(style);
1165 /// DropDown item size.
1167 /// <since_tizen> 6 </since_tizen>
1168 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1169 [EditorBrowsable(EditorBrowsableState.Never)]
1174 return itemDataStyle.Size;
1178 itemDataStyle.Size = value;
1183 /// DropDown item background color selector.
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 Selector<Color> BackgroundColorSelector
1192 return itemDataStyle.BackgroundColor;
1196 if (itemDataStyle.BackgroundColor == null)
1198 itemDataStyle.BackgroundColor = new Selector<Color>();
1201 itemDataStyle.BackgroundColor.Clone(value);
1206 /// DropDown item text string.
1208 /// <since_tizen> 6 </since_tizen>
1209 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1210 [EditorBrowsable(EditorBrowsableState.Never)]
1215 return itemDataStyle.Text?.Text?.All;
1219 CreateTextAttributes();
1220 if (itemDataStyle.Text.Text == null)
1222 itemDataStyle.Text.Text = new Selector<string> { All = value };
1226 itemDataStyle.Text.Text.All = value;
1232 /// DropDown item text's point size.
1234 /// <since_tizen> 6 </since_tizen>
1235 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1236 [EditorBrowsable(EditorBrowsableState.Never)]
1237 public float PointSize
1241 return itemDataStyle.Text?.PointSize?.All ?? 0;
1245 CreateTextAttributes();
1246 if (itemDataStyle.Text.PointSize == null)
1248 itemDataStyle.Text.PointSize = new Selector<float?> { All = value };
1252 itemDataStyle.Text.PointSize.All = value;
1258 /// DropDown item text's font family.
1260 /// <since_tizen> 6 </since_tizen>
1261 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1262 [EditorBrowsable(EditorBrowsableState.Never)]
1263 public string FontFamily
1268 //return itemDataAttributes.TextAttributes?.FontFamily?.GetValue(State);
1272 CreateTextAttributes();
1273 itemDataStyle.Text.FontFamily = value;
1278 /// DropDown item text's position.
1280 /// <since_tizen> 6 </since_tizen>
1281 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1282 [EditorBrowsable(EditorBrowsableState.Never)]
1283 public Position TextPosition
1287 return itemDataStyle.Text?.Position;
1291 CreateTextAttributes();
1292 itemDataStyle.Text.Position = value;
1297 /// DropDown item's icon's resource url.
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 string IconResourceUrl
1306 return itemDataStyle.Icon?.ResourceUrl?.All;
1310 CreateIconAttributes();
1311 if (itemDataStyle.Icon.ResourceUrl == null)
1313 itemDataStyle.Icon.ResourceUrl = new Selector<string> { All = value };
1317 itemDataStyle.Icon.ResourceUrl.All = value;
1323 /// DropDown item's icon's size.
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 Size IconSize
1332 return itemDataStyle.Icon?.Size;
1336 CreateIconAttributes();
1337 itemDataStyle.Icon.Size = value;
1342 /// DropDown item's icon'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 IconPosition
1351 return itemDataStyle.Icon.Position;
1355 CreateIconAttributes();
1356 itemDataStyle.Icon.Position = value;
1361 /// DropDown item's check image'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 CheckImageResourceUrl
1370 return itemDataStyle.CheckImage?.ResourceUrl?.All;
1374 CreateCheckImageAttributes();
1375 if (itemDataStyle.CheckImage.ResourceUrl == null)
1377 itemDataStyle.CheckImage.ResourceUrl = new Selector<string> { All = value };
1381 itemDataStyle.CheckImage.ResourceUrl.All = value;
1387 /// DropDown item's check image'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 CheckImageSize
1396 return itemDataStyle.CheckImage?.Size;
1400 CreateCheckImageAttributes();
1401 itemDataStyle.CheckImage.Size = value;
1406 /// DropDown item's check image's right space.
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 int CheckImageGapToBoundary
1415 return itemDataStyle.CheckImageGapToBoundary;
1419 itemDataStyle.CheckImageGapToBoundary = value;
1424 /// Flag to decide DropDown item is selected or not.
1426 /// <since_tizen> 6 </since_tizen>
1427 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1428 [EditorBrowsable(EditorBrowsableState.Never)]
1429 public bool IsSelected
1433 return itemDataStyle.IsSelected;
1437 itemDataStyle.IsSelected = value;
1441 private void Initialize()
1443 if (itemDataStyle == null)
1445 throw new Exception("Button attribute parse error.");
1449 private void CreateTextAttributes()
1451 if(itemDataStyle.Text== null)
1453 itemDataStyle.Text= new TextLabelStyle
1455 PositionUsesPivotPoint = true,
1456 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1457 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1458 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1459 HeightResizePolicy = ResizePolicyType.FillToParent,
1460 VerticalAlignment = VerticalAlignment.Center,
1461 HorizontalAlignment = HorizontalAlignment.Begin,
1466 private void CreateIconAttributes()
1468 if (itemDataStyle.Icon== null)
1470 itemDataStyle.Icon= new ImageViewStyle
1472 PositionUsesPivotPoint = true,
1473 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1474 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1479 private void CreateCheckImageAttributes()
1481 if (itemDataStyle.CheckImage== null)
1483 itemDataStyle.CheckImage= new ImageViewStyle
1485 PositionUsesPivotPoint = true,
1486 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1487 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1494 #region DropDownItemView
1495 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1496 [EditorBrowsable(EditorBrowsableState.Never)]
1497 internal class DropDownItemView : Control
1499 private TextLabel mText = null;
1500 private ImageView mIcon = null;
1501 private ImageView mCheck = null;
1503 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1504 [EditorBrowsable(EditorBrowsableState.Never)]
1505 public DropDownItemView() : base()
1509 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1510 [EditorBrowsable(EditorBrowsableState.Never)]
1511 public Selector<Color> BackgroundColorSelector
1517 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1518 [EditorBrowsable(EditorBrowsableState.Never)]
1536 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1537 [EditorBrowsable(EditorBrowsableState.Never)]
1538 public string FontFamily
1546 return mText.FontFamily;
1551 mText.FontFamily = value;
1555 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1556 [EditorBrowsable(EditorBrowsableState.Never)]
1557 public float? PointSize
1565 return mText.PointSize;
1570 mText.PointSize = (float)value;
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 Color TextColor
1584 return mText.TextColor;
1589 mText.TextColor = value;
1593 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1594 [EditorBrowsable(EditorBrowsableState.Never)]
1595 public Position TextPosition
1603 return mText.Position;
1608 mText.Position = value;
1612 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1613 [EditorBrowsable(EditorBrowsableState.Never)]
1614 public string IconResourceUrl
1622 return mIcon.ResourceUrl;
1627 mIcon.ResourceUrl = value;
1631 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1632 [EditorBrowsable(EditorBrowsableState.Never)]
1633 public Size IconSize
1650 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1651 [EditorBrowsable(EditorBrowsableState.Never)]
1652 public Position IconPosition
1660 return mIcon.Position;
1665 mIcon.Position = value;
1669 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1670 [EditorBrowsable(EditorBrowsableState.Never)]
1671 public string CheckResourceUrl
1679 return mCheck.ResourceUrl;
1684 mCheck.ResourceUrl = value;
1688 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1689 [EditorBrowsable(EditorBrowsableState.Never)]
1690 public Position CheckPosition
1698 return mCheck.Position;
1703 mCheck.Position = value;
1707 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1708 [EditorBrowsable(EditorBrowsableState.Never)]
1709 public Size CheckImageSize
1722 mCheck.Size = value;
1726 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1727 [EditorBrowsable(EditorBrowsableState.Never)]
1728 public bool IsSelected
1736 return mCheck.Visibility;
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 protected override void Dispose(DisposeTypes type)
1761 if (type == DisposeTypes.Explicit)
1787 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1788 [EditorBrowsable(EditorBrowsableState.Never)]
1789 protected override ViewStyle GetViewStyle()
1794 private void CreateIcon()
1798 mIcon = new ImageView()
1800 PositionUsesPivotPoint = true,
1801 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1802 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1808 private void CreateText()
1812 mText = new TextLabel()
1814 PositionUsesPivotPoint = true,
1815 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1816 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1817 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1818 HeightResizePolicy = ResizePolicyType.FillToParent,
1819 VerticalAlignment = VerticalAlignment.Center,
1820 HorizontalAlignment = HorizontalAlignment.Begin,
1826 private void CreateCheckImage()
1830 mCheck = new ImageView()
1832 PositionUsesPivotPoint = true,
1833 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1834 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1835 Name = "checkedImage",
1844 #region DropDownListBridge
1847 /// DropDownListBridge is bridge to connect item data and an item View.
1849 /// <since_tizen> 6 </since_tizen>
1850 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1851 [EditorBrowsable(EditorBrowsableState.Never)]
1852 public class DropDownListBridge
1854 private List<DropDownDataItem> itemDataList = new List<DropDownDataItem>();
1856 internal bool AdapterPurge {get;set;} = false; // Set to true if adapter content changed since last iteration.
1859 /// Creates a new instance of a DropDownListBridge.
1861 /// <since_tizen> 6 </since_tizen>
1862 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1863 [EditorBrowsable(EditorBrowsableState.Never)]
1864 public DropDownListBridge()
1869 /// Insert data. The inserted data will be added to the special position by index automatically.
1871 /// <param name="position">Position index where will be inserted.</param>
1872 /// <param name="data">Item data which will apply to tab item view.</param>
1873 /// <since_tizen> 6 </since_tizen>
1874 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1875 [EditorBrowsable(EditorBrowsableState.Never)]
1876 public void InsertData(int position, DropDownDataItem data)
1880 position = itemDataList.Count;
1882 itemDataList.Insert(position, data);
1883 AdapterPurge = true;
1887 /// Remove data by position.
1889 /// <param name="position">Position index where will be removed.</param>
1890 /// <since_tizen> 6 </since_tizen>
1891 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1892 [EditorBrowsable(EditorBrowsableState.Never)]
1893 public void RemoveData(int position)
1895 itemDataList.RemoveAt(position);
1896 AdapterPurge = true;
1900 /// Get data by position.
1902 /// <param name="position">Position index where will be gotten.</param>
1903 /// <since_tizen> 6 </since_tizen>
1904 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1905 [EditorBrowsable(EditorBrowsableState.Never)]
1906 public DropDownDataItem GetData(int position)
1908 return itemDataList[position];
1912 /// Get view holder by view type.
1914 /// <since_tizen> 6 </since_tizen>
1915 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1916 [EditorBrowsable(EditorBrowsableState.Never)]
1917 public ViewHolder OnCreateViewHolder()
1919 ViewHolder viewHolder = new ViewHolder(new DropDownItemView());
1925 /// Bind ViewHolder with View.
1927 /// <param name="holder">View holder.</param>
1928 /// <param name="position">Position index of source data.</param>
1929 /// <since_tizen> 6 </since_tizen>
1930 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1931 [EditorBrowsable(EditorBrowsableState.Never)]
1932 public void BindViewHolder(ViewHolder holder, int position)
1934 DropDownDataItem listItemData = itemDataList[position];
1935 if(listItemData == null)
1939 DropDownItemView listItemView = holder.ItemView as DropDownItemView;
1940 listItemView.Name = "Item" + position;
1941 if (listItemData.Size != null)
1943 if (listItemData.Size.Width > 0)
1945 holder.ItemView.WidthSpecification = (int)listItemData.Size.Width;
1949 holder.ItemView.WidthSpecification = LayoutParamPolicies.MatchParent;
1952 if (listItemData.Size.Height > 0)
1954 holder.ItemView.HeightSpecification = (int)listItemData.Size.Height;
1958 holder.ItemView.HeightSpecification = LayoutParamPolicies.MatchParent;
1962 if (listItemView != null)
1964 listItemView.BackgroundColorSelector = listItemData.BackgroundColorSelector;
1965 if (listItemData.Text != null)
1967 listItemView.Text = listItemData.Text;
1968 listItemView.PointSize = listItemData.PointSize;
1969 listItemView.FontFamily = listItemData.FontFamily;
1970 listItemView.TextPosition = listItemData.TextPosition;
1973 if (listItemData.IconResourceUrl != null)
1975 listItemView.IconResourceUrl = listItemData.IconResourceUrl;
1976 listItemView.IconSize = listItemData.IconSize;
1977 if (listItemView.IconSize != null)
1979 listItemView.IconPosition = new Position(listItemData.IconPosition.X, (listItemView.Size2D.Height - listItemView.IconSize.Height) / 2);
1983 if (listItemData.CheckImageResourceUrl != null)
1985 listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
1986 listItemView.CheckImageSize = listItemData.CheckImageSize;
1987 if (listItemView.CheckImageSize != null)
1989 listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageGapToBoundary - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2);
1993 listItemView.IsSelected = listItemData.IsSelected;
1998 /// Destroy view holder, it can be override.
2000 /// <param name="holder">View holder.</param>
2001 /// <since_tizen> 6 </since_tizen>
2002 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2003 [EditorBrowsable(EditorBrowsableState.Never)]
2004 public void OnDestroyViewHolder(ViewHolder holder)
2006 if (holder.ItemView != null)
2008 holder.ItemView.Dispose();
2013 /// Get item count, it can be override.
2015 /// <since_tizen> 6 </since_tizen>
2016 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2017 [EditorBrowsable(EditorBrowsableState.Never)]
2018 public int GetItemCount()
2020 return itemDataList.Count;
2028 /// A ViewHolder is a class that holds a View created from DropDownListBridge data.
2030 /// <since_tizen> 6 </since_tizen>
2031 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2032 [EditorBrowsable(EditorBrowsableState.Never)]
2033 public class ViewHolder
2036 /// ViewHolder constructor.
2038 /// <param name="itemView">View</param>
2039 /// <since_tizen> 6 </since_tizen>
2040 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2041 [EditorBrowsable(EditorBrowsableState.Never)]
2042 public ViewHolder(View itemView)
2044 if (itemView == null)
2046 throw new ArgumentNullException("itemView may not be null");
2048 this.ItemView = itemView;
2052 /// Returns the view.
2054 /// <since_tizen> 6 </since_tizen>
2055 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2056 [EditorBrowsable(EditorBrowsableState.Never)]
2057 public View ItemView { get; }
2059 internal bool IsBound