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 SetListItemToSelected(listItemView);
970 DropDownDataItem data = adapter.GetData(index);
973 data.IsSelected = true;
974 DropDownItemView listItemView = dropDownMenuFullList?.GetChildAt((uint)index) as DropDownItemView;
977 SetListItemToSelected(listItemView);
982 selectedItemIndex = index;
983 dropDownMenuFullList?.Layout?.RequestLayout();
986 private void CreateListBackgroundImage()
988 if (null == listBackgroundImage)
990 listBackgroundImage = new ImageView
992 Name = "ListBackgroundImage",
993 PositionUsesPivotPoint = true,
994 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
995 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
996 WidthResizePolicy = ResizePolicyType.FitToChildren,
997 HeightResizePolicy = ResizePolicyType.FitToChildren,
999 Add(listBackgroundImage);
1003 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
1006 listBackgroundImage.Show();
1007 dropDownMenuFullList?.Layout?.RequestLayout();
1008 listBackgroundImage.RaiseToTop();
1011 private void CreateHeaderTextAttributes()
1013 if (Style.HeaderText == null)
1015 Style.HeaderText = new TextLabelStyle()
1017 PositionUsesPivotPoint = true,
1018 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1019 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1020 WidthResizePolicy = ResizePolicyType.FillToParent,
1021 HeightResizePolicy = ResizePolicyType.FillToParent,
1022 HorizontalAlignment = HorizontalAlignment.Center,
1023 VerticalAlignment = VerticalAlignment.Center,
1028 private void CreateButtonAttributes()
1030 if (Style.Button == null)
1032 Style.Button = new ButtonStyle();
1036 private void CreateButtonTextAttributes()
1038 CreateButtonAttributes();
1040 if (Style.Button.Text== null)
1042 Style.Button.Text= new TextLabelStyle
1044 PositionUsesPivotPoint = true,
1045 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1046 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1047 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1048 HeightResizePolicy = ResizePolicyType.FillToParent,
1049 Position = new Position(0, 0),
1050 HorizontalAlignment = HorizontalAlignment.Begin,
1051 VerticalAlignment = VerticalAlignment.Center,
1056 private void CreateButtonIconAttributes()
1058 CreateButtonAttributes();
1060 if (Style.Button.Icon== null)
1062 Style.Button.Icon= new ImageViewStyle
1064 PositionUsesPivotPoint = true,
1065 ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight,
1066 PivotPoint = Tizen.NUI.PivotPoint.CenterRight,
1071 private void CreateListBackgroundAttributes()
1073 if (Style.ListBackgroundImage == null)
1075 Style.ListBackgroundImage = new ImageViewStyle
1077 PositionUsesPivotPoint = true,
1078 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1079 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1085 #region ItemClickEventArgs
1087 /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
1089 /// <since_tizen> 6 </since_tizen>
1090 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1091 [EditorBrowsable(EditorBrowsableState.Never)]
1092 public class ItemClickEventArgs : EventArgs
1094 /// <summary> Clicked item index of DropDown's list </summary>
1095 /// <since_tizen> 6 </since_tizen>
1096 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1097 [EditorBrowsable(EditorBrowsableState.Never)]
1099 /// <summary> Clicked item text string of DropDown's list </summary>
1100 /// <since_tizen> 6 </since_tizen>
1101 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1102 [EditorBrowsable(EditorBrowsableState.Never)]
1107 #region DropDownDataItem
1109 /// DropDownDataItem is a class to record all data which will be applied to DropDown item.
1111 /// <since_tizen> 6 </since_tizen>
1112 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1113 //[EditorBrowsable(EditorBrowsableState.Never)]
1114 public class DropDownDataItem
1116 private DropDownItemStyle itemDataStyle = new DropDownItemStyle();
1119 /// Creates a new instance of a DropDownItemData.
1121 /// <since_tizen> 6 </since_tizen>
1122 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1123 [EditorBrowsable(EditorBrowsableState.Never)]
1124 public DropDownDataItem()
1130 /// Creates a new instance of a DropDownItemData with style.
1132 /// <param name="style">Create DropDownItemData by special style defined in UX.</param>
1133 /// <since_tizen> 6 </since_tizen>
1134 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1135 [EditorBrowsable(EditorBrowsableState.Never)]
1136 public DropDownDataItem(string style)
1140 ViewStyle attributes = StyleManager.Instance.GetAttributes(style);
1141 if(attributes == null)
1143 throw new InvalidOperationException($"There is no style {style}");
1145 itemDataStyle = attributes as DropDownItemStyle;
1151 /// Creates a new instance of a DropDownItemData with style.
1153 /// <param name="style">Create DropDownItemData by style customized by user.</param>
1154 /// <since_tizen> 6 </since_tizen>
1155 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1156 [EditorBrowsable(EditorBrowsableState.Never)]
1157 public DropDownDataItem(DropDownItemStyle style)
1159 itemDataStyle.CopyFrom(style);
1164 /// DropDown item size.
1166 /// <since_tizen> 6 </since_tizen>
1167 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1168 [EditorBrowsable(EditorBrowsableState.Never)]
1173 return itemDataStyle.Size;
1177 itemDataStyle.Size = value;
1182 /// DropDown item background color selector.
1184 /// <since_tizen> 6 </since_tizen>
1185 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1186 [EditorBrowsable(EditorBrowsableState.Never)]
1187 public Selector<Color> BackgroundColorSelector
1191 return itemDataStyle.BackgroundColor;
1195 if (itemDataStyle.BackgroundColor == null)
1197 itemDataStyle.BackgroundColor = new Selector<Color>();
1200 itemDataStyle.BackgroundColor?.Clone(value);
1205 /// DropDown item text string.
1207 /// <since_tizen> 6 </since_tizen>
1208 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1209 [EditorBrowsable(EditorBrowsableState.Never)]
1214 return itemDataStyle.Text?.Text?.All;
1218 CreateTextAttributes();
1219 if (itemDataStyle.Text.Text == null)
1221 itemDataStyle.Text.Text = new Selector<string> { All = value };
1225 itemDataStyle.Text.Text.All = value;
1231 /// DropDown item text's point size.
1233 /// <since_tizen> 6 </since_tizen>
1234 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1235 [EditorBrowsable(EditorBrowsableState.Never)]
1236 public float PointSize
1240 return itemDataStyle.Text?.PointSize?.All ?? 0;
1244 CreateTextAttributes();
1245 if (itemDataStyle.Text.PointSize == null)
1247 itemDataStyle.Text.PointSize = new Selector<float?> { All = value };
1251 itemDataStyle.Text.PointSize.All = value;
1257 /// DropDown item text's font family.
1259 /// <since_tizen> 6 </since_tizen>
1260 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1261 [EditorBrowsable(EditorBrowsableState.Never)]
1262 public string FontFamily
1267 //return itemDataAttributes.TextAttributes?.FontFamily?.GetValue(State);
1271 CreateTextAttributes();
1272 itemDataStyle.Text.FontFamily = value;
1277 /// DropDown item text's position.
1279 /// <since_tizen> 6 </since_tizen>
1280 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1281 [EditorBrowsable(EditorBrowsableState.Never)]
1282 public Position TextPosition
1286 return itemDataStyle.Text?.Position;
1290 CreateTextAttributes();
1291 itemDataStyle.Text.Position = value;
1296 /// DropDown item's icon's resource url.
1298 /// <since_tizen> 6 </since_tizen>
1299 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1300 [EditorBrowsable(EditorBrowsableState.Never)]
1301 public string IconResourceUrl
1305 return itemDataStyle.Icon?.ResourceUrl?.All;
1309 CreateIconAttributes();
1310 if (itemDataStyle.Icon.ResourceUrl == null)
1312 itemDataStyle.Icon.ResourceUrl = new Selector<string> { All = value };
1316 itemDataStyle.Icon.ResourceUrl.All = value;
1322 /// DropDown item's icon's size.
1324 /// <since_tizen> 6 </since_tizen>
1325 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1326 [EditorBrowsable(EditorBrowsableState.Never)]
1327 public Size IconSize
1331 return itemDataStyle.Icon?.Size;
1335 CreateIconAttributes();
1336 itemDataStyle.Icon.Size = value;
1341 /// DropDown item's icon's position.
1343 /// <since_tizen> 6 </since_tizen>
1344 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1345 [EditorBrowsable(EditorBrowsableState.Never)]
1346 public Position IconPosition
1350 return itemDataStyle.Icon.Position;
1354 CreateIconAttributes();
1355 itemDataStyle.Icon.Position = value;
1360 /// DropDown item's check image's resource url.
1362 /// <since_tizen> 6 </since_tizen>
1363 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1364 [EditorBrowsable(EditorBrowsableState.Never)]
1365 public string CheckImageResourceUrl
1369 return itemDataStyle.CheckImage?.ResourceUrl?.All;
1373 CreateCheckImageAttributes();
1374 if (itemDataStyle.CheckImage.ResourceUrl == null)
1376 itemDataStyle.CheckImage.ResourceUrl = new Selector<string> { All = value };
1380 itemDataStyle.CheckImage.ResourceUrl.All = value;
1386 /// DropDown item's check image's size.
1388 /// <since_tizen> 6 </since_tizen>
1389 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1390 [EditorBrowsable(EditorBrowsableState.Never)]
1391 public Size CheckImageSize
1395 return itemDataStyle.CheckImage?.Size;
1399 CreateCheckImageAttributes();
1400 itemDataStyle.CheckImage.Size = value;
1405 /// DropDown item's check image's right space.
1407 /// <since_tizen> 6 </since_tizen>
1408 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1409 [EditorBrowsable(EditorBrowsableState.Never)]
1410 public int CheckImageGapToBoundary
1414 return itemDataStyle.CheckImageGapToBoundary;
1418 itemDataStyle.CheckImageGapToBoundary = value;
1423 /// Flag to decide DropDown item is selected or not.
1425 /// <since_tizen> 6 </since_tizen>
1426 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1427 [EditorBrowsable(EditorBrowsableState.Never)]
1428 public bool IsSelected
1432 return itemDataStyle.IsSelected;
1436 itemDataStyle.IsSelected = value;
1440 private void Initialize()
1442 if (itemDataStyle == null)
1444 throw new Exception("Button attribute parse error.");
1448 private void CreateTextAttributes()
1450 if(itemDataStyle.Text== null)
1452 itemDataStyle.Text= new TextLabelStyle
1454 PositionUsesPivotPoint = true,
1455 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1456 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1457 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1458 HeightResizePolicy = ResizePolicyType.FillToParent,
1459 VerticalAlignment = VerticalAlignment.Center,
1460 HorizontalAlignment = HorizontalAlignment.Begin,
1465 private void CreateIconAttributes()
1467 if (itemDataStyle.Icon== null)
1469 itemDataStyle.Icon= new ImageViewStyle
1471 PositionUsesPivotPoint = true,
1472 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1473 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1478 private void CreateCheckImageAttributes()
1480 if (itemDataStyle.CheckImage== null)
1482 itemDataStyle.CheckImage= new ImageViewStyle
1484 PositionUsesPivotPoint = true,
1485 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1486 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1493 #region DropDownItemView
1494 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1495 [EditorBrowsable(EditorBrowsableState.Never)]
1496 internal class DropDownItemView : Control
1498 private TextLabel mText = null;
1499 private ImageView mIcon = null;
1500 private ImageView mCheck = null;
1502 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1503 [EditorBrowsable(EditorBrowsableState.Never)]
1504 public DropDownItemView() : base()
1508 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1509 [EditorBrowsable(EditorBrowsableState.Never)]
1510 public Selector<Color> BackgroundColorSelector
1516 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1517 [EditorBrowsable(EditorBrowsableState.Never)]
1535 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1536 [EditorBrowsable(EditorBrowsableState.Never)]
1537 public string FontFamily
1545 return mText.FontFamily;
1550 mText.FontFamily = value;
1554 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1555 [EditorBrowsable(EditorBrowsableState.Never)]
1556 public float? PointSize
1564 return mText.PointSize;
1569 mText.PointSize = (float)value;
1573 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1574 [EditorBrowsable(EditorBrowsableState.Never)]
1575 public Color TextColor
1583 return mText.TextColor;
1588 mText.TextColor = value;
1592 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1593 [EditorBrowsable(EditorBrowsableState.Never)]
1594 public Position TextPosition
1602 return mText.Position;
1607 mText.Position = value;
1611 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1612 [EditorBrowsable(EditorBrowsableState.Never)]
1613 public string IconResourceUrl
1621 return mIcon.ResourceUrl;
1626 mIcon.ResourceUrl = value;
1630 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1631 [EditorBrowsable(EditorBrowsableState.Never)]
1632 public Size IconSize
1649 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1650 [EditorBrowsable(EditorBrowsableState.Never)]
1651 public Position IconPosition
1659 return mIcon.Position;
1664 mIcon.Position = value;
1668 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1669 [EditorBrowsable(EditorBrowsableState.Never)]
1670 public string CheckResourceUrl
1678 return mCheck.ResourceUrl;
1683 mCheck.ResourceUrl = value;
1687 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1688 [EditorBrowsable(EditorBrowsableState.Never)]
1689 public Position CheckPosition
1697 return mCheck.Position;
1702 mCheck.Position = value;
1706 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1707 [EditorBrowsable(EditorBrowsableState.Never)]
1708 public Size CheckImageSize
1721 mCheck.Size = value;
1725 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1726 [EditorBrowsable(EditorBrowsableState.Never)]
1727 public bool IsSelected
1735 return mCheck.Visibility;
1751 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1752 [EditorBrowsable(EditorBrowsableState.Never)]
1753 protected override void Dispose(DisposeTypes type)
1760 if (type == DisposeTypes.Explicit)
1786 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1787 [EditorBrowsable(EditorBrowsableState.Never)]
1788 protected override ViewStyle GetViewStyle()
1793 private void CreateIcon()
1797 mIcon = new ImageView()
1799 PositionUsesPivotPoint = true,
1800 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1801 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1807 private void CreateText()
1811 mText = new TextLabel()
1813 PositionUsesPivotPoint = true,
1814 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1815 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1816 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
1817 HeightResizePolicy = ResizePolicyType.FillToParent,
1818 VerticalAlignment = VerticalAlignment.Center,
1819 HorizontalAlignment = HorizontalAlignment.Begin,
1825 private void CreateCheckImage()
1829 mCheck = new ImageView()
1831 PositionUsesPivotPoint = true,
1832 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
1833 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
1834 Name = "checkedImage",
1843 #region DropDownListBridge
1846 /// DropDownListBridge is bridge to connect item data and an item View.
1848 /// <since_tizen> 6 </since_tizen>
1849 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1850 [EditorBrowsable(EditorBrowsableState.Never)]
1851 public class DropDownListBridge
1853 private List<DropDownDataItem> itemDataList = new List<DropDownDataItem>();
1855 internal bool AdapterPurge {get;set;} = false; // Set to true if adapter content changed since last iteration.
1858 /// Creates a new instance of a DropDownListBridge.
1860 /// <since_tizen> 6 </since_tizen>
1861 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1862 [EditorBrowsable(EditorBrowsableState.Never)]
1863 public DropDownListBridge()
1868 /// Insert data. The inserted data will be added to the special position by index automatically.
1870 /// <param name="position">Position index where will be inserted.</param>
1871 /// <param name="data">Item data which will apply to tab item view.</param>
1872 /// <since_tizen> 6 </since_tizen>
1873 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1874 [EditorBrowsable(EditorBrowsableState.Never)]
1875 public void InsertData(int position, DropDownDataItem data)
1879 position = itemDataList.Count;
1881 itemDataList.Insert(position, data);
1882 AdapterPurge = true;
1886 /// Remove data by position.
1888 /// <param name="position">Position index where will be removed.</param>
1889 /// <since_tizen> 6 </since_tizen>
1890 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1891 [EditorBrowsable(EditorBrowsableState.Never)]
1892 public void RemoveData(int position)
1894 itemDataList.RemoveAt(position);
1895 AdapterPurge = true;
1899 /// Get data by position.
1901 /// <param name="position">Position index where will be gotten.</param>
1902 /// <since_tizen> 6 </since_tizen>
1903 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1904 [EditorBrowsable(EditorBrowsableState.Never)]
1905 public DropDownDataItem GetData(int position)
1907 return itemDataList[position];
1911 /// Get view holder by view type.
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 ViewHolder OnCreateViewHolder()
1918 ViewHolder viewHolder = new ViewHolder(new DropDownItemView());
1924 /// Bind ViewHolder with View.
1926 /// <param name="holder">View holder.</param>
1927 /// <param name="position">Position index of source data.</param>
1928 /// <since_tizen> 6 </since_tizen>
1929 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1930 [EditorBrowsable(EditorBrowsableState.Never)]
1931 public void BindViewHolder(ViewHolder holder, int position)
1933 DropDownDataItem listItemData = itemDataList[position];
1934 if(listItemData == null)
1938 DropDownItemView listItemView = holder.ItemView as DropDownItemView;
1939 listItemView.Name = "Item" + position;
1940 if (listItemData.Size != null)
1942 if (listItemData.Size.Width > 0)
1944 holder.ItemView.WidthSpecification = (int)listItemData.Size.Width;
1948 holder.ItemView.WidthSpecification = LayoutParamPolicies.MatchParent;
1951 if (listItemData.Size.Height > 0)
1953 holder.ItemView.HeightSpecification = (int)listItemData.Size.Height;
1957 holder.ItemView.HeightSpecification = LayoutParamPolicies.MatchParent;
1961 if (listItemView != null)
1963 listItemView.BackgroundColorSelector = listItemData.BackgroundColorSelector;
1964 if (listItemData.Text != null)
1966 listItemView.Text = listItemData.Text;
1967 listItemView.PointSize = listItemData.PointSize;
1968 listItemView.FontFamily = listItemData.FontFamily;
1969 listItemView.TextPosition = listItemData.TextPosition;
1972 if (listItemData.IconResourceUrl != null)
1974 listItemView.IconResourceUrl = listItemData.IconResourceUrl;
1975 listItemView.IconSize = listItemData.IconSize;
1976 if (listItemView.IconSize != null)
1978 listItemView.IconPosition = new Position(listItemData.IconPosition.X, (listItemView.Size2D.Height - listItemView.IconSize.Height) / 2);
1982 if (listItemData.CheckImageResourceUrl != null)
1984 listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
1985 listItemView.CheckImageSize = listItemData.CheckImageSize;
1986 if (listItemView.CheckImageSize != null)
1988 listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageGapToBoundary - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2);
1992 listItemView.IsSelected = listItemData.IsSelected;
1997 /// Destroy view holder, it can be override.
1999 /// <param name="holder">View holder.</param>
2000 /// <since_tizen> 6 </since_tizen>
2001 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2002 [EditorBrowsable(EditorBrowsableState.Never)]
2003 public void OnDestroyViewHolder(ViewHolder holder)
2005 if (holder.ItemView != null)
2007 holder.ItemView.Dispose();
2012 /// Get item count, it can be override.
2014 /// <since_tizen> 6 </since_tizen>
2015 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2016 [EditorBrowsable(EditorBrowsableState.Never)]
2017 public int GetItemCount()
2019 return itemDataList.Count;
2027 /// A ViewHolder is a class that holds a View created from DropDownListBridge data.
2029 /// <since_tizen> 6 </since_tizen>
2030 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2031 [EditorBrowsable(EditorBrowsableState.Never)]
2032 public class ViewHolder
2035 /// ViewHolder constructor.
2037 /// <param name="itemView">View</param>
2038 /// <since_tizen> 6 </since_tizen>
2039 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2040 [EditorBrowsable(EditorBrowsableState.Never)]
2041 public ViewHolder(View itemView)
2043 if (itemView == null)
2045 throw new ArgumentNullException("itemView may not be null");
2047 this.ItemView = itemView;
2051 /// Returns the view.
2053 /// <since_tizen> 6 </since_tizen>
2054 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2055 [EditorBrowsable(EditorBrowsableState.Never)]
2056 public View ItemView { get; }
2058 internal bool IsBound