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 partial 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(nameof(ListPadding), typeof(Extents), typeof(DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
37 var instance = (DropDown)bindable;
40 instance.listPadding.CopyFrom((Extents)newValue);
41 instance.UpdateDropDown();
44 defaultValueCreator: (bindable) =>
46 var instance = (DropDown)bindable;
47 return instance.listPadding;
49 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create(nameof(SelectedItemIndex), typeof(int), typeof(DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
53 var instance = (DropDown)bindable;
56 int selectedItemIndex = (int)newValue;
57 if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex < 0 || selectedItemIndex >= instance.adapter.GetItemCount())
61 instance.SetListItemToSelected((uint)selectedItemIndex);
64 defaultValueCreator: (bindable) =>
66 var instance = (DropDown)bindable;
67 return instance.selectedItemIndex;
69 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public static readonly BindableProperty ListMarginProperty = BindableProperty.Create(nameof(ListMargin), typeof(Extents), typeof(DropDown), null, propertyChanged: (bindable, oldValue, newValue) =>
73 var instance = (DropDown)bindable;
76 instance.listMargin.CopyFrom((Extents)newValue);
77 instance.UpdateDropDown();
80 defaultValueCreator: (bindable) =>
82 var instance = (DropDown)bindable;
83 return instance.listMargin;
85 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
86 [EditorBrowsable(EditorBrowsableState.Never)]
87 public static readonly BindableProperty ListRelativeOrientationProperty = BindableProperty.Create(nameof(ListRelativeOrientation), typeof(ListOrientation), typeof(DropDown), ListOrientation.Left, propertyChanged: (bindable, oldValue, newValue) =>
89 var instance = (DropDown)bindable;
92 instance.listRelativeOrientation = (ListOrientation)newValue;
93 instance.UpdateDropDown();
96 defaultValueCreator: (bindable) =>
98 var instance = (DropDown)bindable;
99 return instance.listRelativeOrientation;
101 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
102 [EditorBrowsable(EditorBrowsableState.Never)]
103 public static readonly BindableProperty SpaceBetweenButtonTextAndIconProperty = BindableProperty.Create(nameof(SpaceBetweenButtonTextAndIcon), typeof(int), typeof(DropDown), 0, propertyChanged: (bindable, oldValue, newValue) =>
105 var instance = (DropDown)bindable;
106 if (newValue != null)
108 instance.spaceBetweenButtonTextAndIcon = (int)newValue;
111 defaultValueCreator: (bindable) =>
113 var instance = (DropDown)bindable;
114 return instance.spaceBetweenButtonTextAndIcon;
118 private Button button = null;
119 private TextLabel headerText = null;
120 private TextLabel buttonText = null;
121 private ImageView listBackgroundImage = null;
122 // Component that scrolls the child added to it.
123 private ScrollableBase scrollableBase = null;
125 // The LinearLayout container to house the items in the drop down list.
126 private View dropDownMenuFullList = null;
127 private DropDownListBridge adapter = new DropDownListBridge();
128 private DropDownItemView selectedItemView = null;
129 private TapGestureDetector tapGestureDetector = null;
131 private Extents listMargin = new Extents(0, 0, 0, 0);
132 private Extents listPadding = new Extents(0, 0, 0, 0);
133 private ListOrientation listRelativeOrientation = ListOrientation.Left;
134 private int selectedItemIndex = -1;
135 private int spaceBetweenButtonTextAndIcon = 0;
136 private bool itemPressed = false;
138 static DropDown() { }
141 /// Creates a new instance of a DropDown.
143 /// <since_tizen> 6 </since_tizen>
144 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
145 [EditorBrowsable(EditorBrowsableState.Never)]
146 public DropDown() : base() { }
149 /// Creates a new instance of a DropDown with style.
151 /// <param name="style">Create DropDown by special style defined in UX.</param>
152 /// <since_tizen> 6 </since_tizen>
153 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
154 [EditorBrowsable(EditorBrowsableState.Never)]
155 public DropDown(string style) : base(style) { }
158 /// Creates a new instance of a DropDown with style.
160 /// <param name="dropDownStyle">Create DropDown by style customized by user.</param>
161 /// <since_tizen> 6 </since_tizen>
162 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public DropDown(DropDownStyle dropDownStyle) : base(dropDownStyle)
169 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
171 /// <since_tizen> 6 </since_tizen>
172 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public delegate void ClickEventHandler<ClickEventArgs>(object sender, ClickEventArgs e);
177 /// An event for the item clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
179 /// <since_tizen> 6 </since_tizen>
180 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
181 [EditorBrowsable(EditorBrowsableState.Never)]
182 public event ClickEventHandler<ItemClickEventArgs> ItemClickEvent;
185 /// List position in relation to the main button.
187 /// <since_tizen> 6 </since_tizen>
188 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 public enum ListOrientation
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)]
202 /// <since_tizen> 6 </since_tizen>
203 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
209 /// Get or set header text.
211 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
212 [EditorBrowsable(EditorBrowsableState.Never)]
213 public TextLabel HeaderText
217 if (null == headerText)
219 headerText = new TextLabel()
221 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
222 HeightResizePolicy = ResizePolicyType.UseNaturalSize,
223 HorizontalAlignment = HorizontalAlignment.Center,
224 VerticalAlignment = VerticalAlignment.Center,
225 ParentOrigin = NUI.ParentOrigin.Center,
226 PivotPoint = NUI.ParentOrigin.Center,
227 PositionUsesPivotPoint = true,
228 Name = "DropDownHeaderText"
241 /// Get or set button.
243 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
244 [EditorBrowsable(EditorBrowsableState.Never)]
251 button = new Button()
253 ParentOrigin = NUI.ParentOrigin.CenterLeft,
254 PivotPoint = NUI.PivotPoint.CenterLeft,
255 PositionUsesPivotPoint = true,
256 HeightResizePolicy = ResizePolicyType.FitToChildren,
257 IconRelativeOrientation = Button.IconOrientation.Right,
258 Name = "DropDownButton"
260 button.ClickEvent += ButtonClickEvent;
263 if (null == buttonText)
265 buttonText = new TextLabel();
277 /// Get or set the background image of list.
279 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
280 [EditorBrowsable(EditorBrowsableState.Never)]
281 public ImageView ListBackgroundImage
285 if (null == listBackgroundImage)
287 listBackgroundImage = new ImageView()
289 Name = "ListBackgroundImage",
290 PositionUsesPivotPoint = true,
291 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
292 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
293 WidthResizePolicy = ResizePolicyType.FitToChildren,
294 HeightResizePolicy = ResizePolicyType.FitToChildren,
296 Add(listBackgroundImage);
298 if (null == scrollableBase) // scrollableBase used to test of ListContainer Setup invoked already
300 SetUpListContainer();
303 return listBackgroundImage;
307 listBackgroundImage = value;
312 /// Return a copied Style instance of DropDown
315 /// It returns copied Style instance and changing it does not effect to the DropDown.
316 /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
318 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
319 [EditorBrowsable(EditorBrowsableState.Never)]
320 //public new DropDownStyle Style
324 // return new DropDownStyle(ViewStyle as DropDownStyle);
327 public new DropDownStyle Style => ViewStyle as DropDownStyle;
330 /// Space between button text and button icon in DropDown.
332 /// <since_tizen> 6 </since_tizen>
333 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
334 public int SpaceBetweenButtonTextAndIcon
336 get => (int)GetValue(SpaceBetweenButtonTextAndIconProperty);
337 set => SetValue(SpaceBetweenButtonTextAndIconProperty, value);
341 /// List relative orientation in DropDown.
343 /// <since_tizen> 6 </since_tizen>
344 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
345 public ListOrientation ListRelativeOrientation
347 get => (ListOrientation)GetValue(ListRelativeOrientationProperty);
348 set => SetValue(ListRelativeOrientationProperty, value);
354 /// <since_tizen> 6 </since_tizen>
355 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
356 public Extents ListMargin
360 Extents tmp = (Extents)GetValue(ListMarginProperty);
361 return new Extents((ushort start, ushort end, ushort top, ushort bottom) => { ListMargin = new Extents(start, end, top, bottom); }, tmp.Start, tmp.End, tmp.Top, tmp.Bottom);
363 set => SetValue(ListMarginProperty, value);
367 /// Selected item index in list.
369 /// <since_tizen> 6 </since_tizen>
370 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
371 public int SelectedItemIndex
373 get => (int)GetValue(SelectedItemIndexProperty);
374 set => SetValue(SelectedItemIndexProperty, value);
378 /// List padding in DropDown.
380 /// <since_tizen> 6 </since_tizen>
381 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
382 public Extents ListPadding
386 Extents tmp = (Extents)GetValue(ListPaddingProperty);
387 return new Extents((ushort start, ushort end, ushort top, ushort bottom) => { ListPadding = new Extents(start, end, top, bottom); }, tmp.Start, tmp.End, tmp.Top, tmp.Bottom);
389 set => SetValue(ListPaddingProperty, value);
393 /// Add list item by item data. The added item will be added to end of all items automatically.
395 /// <param name="itemData">Item data which will apply to tab item view.</param>
396 /// <since_tizen> 6 </since_tizen>
397 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
398 [EditorBrowsable(EditorBrowsableState.Never)]
399 public void AddItem(DropDownDataItem itemData)
401 // Add item to adaptor, will be added to list via AddItemAt during OnUpdate()
402 int insertionPosition = adapter.GetItemCount();
403 adapter.InsertData(insertionPosition, itemData);
407 /// Delete list item by index.
409 /// <param name="index">Position index where will be deleted.</param>
410 /// <since_tizen> 6 </since_tizen>
411 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
412 [EditorBrowsable(EditorBrowsableState.Never)]
413 public void DeleteItem(int index)
415 if (index < 0 || index >= adapter?.GetItemCount()) return;
416 if (null == dropDownMenuFullList) return;
418 if (selectedItemIndex == index)
420 selectedItemIndex = -1;
422 else if(selectedItemIndex > index)
427 adapter?.RemoveData(index);
429 if(index < dropDownMenuFullList.ChildCount)
431 View childToRemove = dropDownMenuFullList.GetChildAt((uint)index);
434 childToRemove.TouchEvent -= ListItemTouchEvent;
435 dropDownMenuFullList.Remove(childToRemove);
436 dropDownMenuFullList?.Layout?.RequestLayout();
442 /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
444 /// <param name="item">Item data which will apply to tab item view.</param>
445 /// <param name="index">Position index where will be inserted.</param>
446 /// <since_tizen> 6 </since_tizen>
447 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
448 [EditorBrowsable(EditorBrowsableState.Never)]
449 public void InsertItem(DropDownDataItem item, int index)
451 if (index < 0 || index >= adapter.GetItemCount())
456 if (selectedItemIndex >= index)
461 adapter.InsertData(index, item);
465 /// Add scroll bar to list.
467 /// <param name="scrollBar">Scroll bar defined by user which will be added to list.</param>
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 [EditorBrowsable(EditorBrowsableState.Never)]
471 public void AttachScrollBar(ScrollBar scrollBar)
473 if (scrollableBase == null)
477 Tizen.Log.Error("DropDown","Feature unsupported");
481 /// Detach scroll bar to list.
483 /// <since_tizen> 6 </since_tizen>
484 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
485 [EditorBrowsable(EditorBrowsableState.Never)]
486 public void DetachScrollBar()
488 if (scrollableBase == null)
492 Tizen.Log.Error("DropDown","Feature unsupported");
495 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
496 [EditorBrowsable(EditorBrowsableState.Never)]
497 public override void ApplyStyle(ViewStyle viewStyle)
499 base.ApplyStyle(viewStyle);
501 DropDownStyle dropDownStyle = viewStyle as DropDownStyle;
502 if (null != dropDownStyle)
504 if (null != dropDownStyle.Button)
506 Button.ApplyStyle(dropDownStyle.Button);
508 if (null != dropDownStyle.HeaderText)
510 HeaderText.ApplyStyle(dropDownStyle.HeaderText);
512 if (null != dropDownStyle.ListBackgroundImage)
514 ListBackgroundImage.ApplyStyle(dropDownStyle.ListBackgroundImage);
521 /// Update DropDown by style.
523 /// <since_tizen> 6 </since_tizen>
524 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
525 [EditorBrowsable(EditorBrowsableState.Never)]
526 protected void UpdateDropDown()
528 if (null == scrollableBase || null == listBackgroundImage || null == dropDownMenuFullList) return;
529 if (null == Style.ListBackgroundImage.Size) return;
530 // Resize and position scrolling list within the drop down list container. Can be used to position list in relation to the background image.
531 scrollableBase.Size = Style.ListBackgroundImage.Size - new Size((listPadding.Start + listPadding.End), (listPadding.Top + listPadding.Bottom), 0);
532 scrollableBase.Position2D = new Position2D(listPadding.Start, listPadding.Top);
534 int listBackgroundImageX = 0;
535 int listBackgroundImageY = 0;
536 if (listRelativeOrientation == ListOrientation.Left)
538 listBackgroundImageX = (int)listMargin.Start;
539 listBackgroundImageY = (int)listMargin.Top;
541 else if (listRelativeOrientation == ListOrientation.Right)
543 listBackgroundImageX = -(int)listMargin.End;
544 listBackgroundImageY = (int)listMargin.Top;
546 listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
547 dropDownMenuFullList?.Layout?.RequestLayout();
553 protected override void OnUpdate()
555 float buttonTextWidth = 0;
556 if (null != buttonText)
558 buttonText.Text = Style.Button.Text.Text.All;
559 buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? StyleManager.PointSizeNormal;
560 buttonTextWidth = buttonText.NaturalSize.Width;
562 float fitWidth = (Style.Button.Icon.Size?.Width ?? 48) + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
563 fitWidth += (button.IconPadding.Start + button.IconPadding.End);
564 button.Size.Width = Math.Max(button.Size.Width, fitWidth);
567 int numberOfItemsToAdd = adapter.GetItemCount();
569 if (adapter.AdapterPurge == true)
571 adapter.AdapterPurge = false;
572 for (int i = 0; i < numberOfItemsToAdd; i++)
574 AddItemAt(adapter.GetData(i), i);
577 // Set selection icon on View
578 if (selectedItemIndex > 0)
580 SetListItemToSelected((uint)selectedItemIndex, selectedItemView);
585 /// Dispose DropDown and all children on it.
587 /// <param name="type">Dispose type.</param>
588 /// <since_tizen> 6 </since_tizen>
589 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
590 [EditorBrowsable(EditorBrowsableState.Never)]
591 protected override void Dispose(DisposeTypes type)
598 if (type == DisposeTypes.Explicit)
600 Utility.Dispose(headerText);
601 Utility.Dispose(buttonText);
602 Utility.Dispose(button);
603 Utility.Dispose(scrollableBase);
604 Utility.Dispose(dropDownMenuFullList);
605 Utility.Dispose(listBackgroundImage);
612 /// Get DropDown style.
614 /// <returns>The default dropdown style.</returns>
615 /// <since_tizen> 6 </since_tizen>
616 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
617 [EditorBrowsable(EditorBrowsableState.Never)]
618 protected override ViewStyle CreateViewStyle()
620 return new DropDownStyle();
623 private void AddItemAt(DropDownDataItem itemData,int index)
625 ViewHolder viewHolder = adapter.OnCreateViewHolder();
626 if (!viewHolder.IsBound)
628 adapter.BindViewHolder(viewHolder, index);
629 viewHolder.IsBound = true;
632 if (tapGestureDetector == null)
634 tapGestureDetector = new TapGestureDetector();
636 View view = viewHolder.ItemView;
637 view.ApplyStyle(itemData.itemDataStyle);
638 view.TouchEvent += ListItemTouchEvent;
639 dropDownMenuFullList.Add(view);
642 private void OnClickEvent(object sender, ItemClickEventArgs e)
644 ItemClickEvent?.Invoke(sender, e);
647 private void CreateButtonText()
649 if (null == buttonText)
651 buttonText = new TextLabel();
655 private void CreateButton()
659 button = new Button()
661 ParentOrigin = NUI.ParentOrigin.CenterLeft,
662 PivotPoint = NUI.PivotPoint.CenterLeft,
663 PositionUsesPivotPoint = true,
664 HeightResizePolicy = ResizePolicyType.FitToChildren,
665 IconRelativeOrientation = Button.IconOrientation.Right,
667 button.Name = "DropDownButton";
668 button.ClickEvent += ButtonClickEvent;
673 private void SetUpListContainer()
675 LinearLayout linear = new LinearLayout()
677 LinearOrientation = LinearLayout.Orientation.Vertical,
680 dropDownMenuFullList = new View()
683 Name = "DropDownMenuList",
684 WidthSpecification = LayoutParamPolicies.MatchParent,
685 HeightSpecification = LayoutParamPolicies.WrapContent,
689 scrollableBase = new ScrollableBase()
693 scrollableBase.Add(dropDownMenuFullList);
695 listBackgroundImage.Add(scrollableBase);
696 listBackgroundImage.Hide();
699 private View GetViewFromIndex(uint index)
701 if ((index < dropDownMenuFullList.ChildCount) && (index >=0) )
703 return dropDownMenuFullList.GetChildAt(index);
711 private void SetListItemToSelected(DropDownItemView view)
713 if (dropDownMenuFullList == null || view == null || view == selectedItemView)
718 uint newSelectedIndex = 0;
719 for (; newSelectedIndex < dropDownMenuFullList.ChildCount; newSelectedIndex++)
721 var itemView = dropDownMenuFullList.GetChildAt(newSelectedIndex) as DropDownItemView;
722 if (itemView == view)
724 SetListItemToSelected(newSelectedIndex, view);
730 private void SetListItemToSelected(uint index)
732 if (dropDownMenuFullList == null || index == selectedItemIndex)
737 SetListItemToSelected(index, GetViewFromIndex(index) as DropDownItemView);
740 private void SetListItemToSelected(uint index, DropDownItemView view)
747 if (selectedItemView != null)
749 selectedItemView.IsSelected = false;
750 selectedItemView.ControlState = ControlStates.Normal;
751 adapter.GetData(selectedItemIndex).IsSelected = false;
754 if (view == null || index >= dropDownMenuFullList.ChildCount)
756 selectedItemIndex = -1;
757 selectedItemView = null;
761 selectedItemIndex = (int)index;
762 selectedItemView = view;
763 selectedItemView.ControlState = ControlStates.Selected;
764 selectedItemView.IsSelected = true;
765 adapter.GetData(selectedItemIndex).IsSelected = true;
766 dropDownMenuFullList.Layout?.RequestLayout();
769 private bool ListItemTouchEvent(object sender, TouchEventArgs e)
771 PointStateType state = e.Touch.GetState(0);
772 DropDownItemView touchedView = sender as DropDownItemView;;
775 case PointStateType.Down:
776 if (touchedView != null)
778 touchedView.ControlState = ControlStates.Pressed;
780 itemPressed = true; // if matched with a Up then a click event.
782 case PointStateType.Motion:
783 if (touchedView != null)
785 touchedView.ControlState = ControlStates.Normal;
789 case PointStateType.Up:
790 if (touchedView != null)
792 if (itemPressed) // if Down was previously sent without motion (Scrolling) in-between then a clicked event occurred.
795 Console.WriteLine("Tapped{0}", touchedView.Name);
796 SetListItemToSelected(touchedView);
797 button.Text = touchedView.Text;
799 listBackgroundImage.Hide();
809 private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
812 listBackgroundImage.Show();
813 dropDownMenuFullList?.Layout?.RequestLayout();
814 listBackgroundImage.RaiseToTop();
819 #region ItemClickEventArgs
821 /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
823 /// <since_tizen> 6 </since_tizen>
824 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
825 [EditorBrowsable(EditorBrowsableState.Never)]
826 public class ItemClickEventArgs : EventArgs
828 /// <summary> Clicked item index of DropDown's list </summary>
829 /// <since_tizen> 6 </since_tizen>
830 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
831 [EditorBrowsable(EditorBrowsableState.Never)]
832 public int Index { get; set; }
833 /// <summary> Clicked item text string of DropDown's list </summary>
834 /// <since_tizen> 6 </since_tizen>
835 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
836 [EditorBrowsable(EditorBrowsableState.Never)]
837 public string Text { get; set; }
844 /// A ViewHolder is a class that holds a View created from DropDownListBridge data.
846 /// <since_tizen> 6 </since_tizen>
847 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
848 [EditorBrowsable(EditorBrowsableState.Never)]
849 public class ViewHolder
852 /// ViewHolder constructor.
854 /// <param name="itemView">View</param>
855 /// <since_tizen> 6 </since_tizen>
856 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
857 [EditorBrowsable(EditorBrowsableState.Never)]
858 public ViewHolder(View itemView)
860 if (itemView == null)
862 throw new ArgumentNullException("itemView may not be null");
864 this.ItemView = itemView;
868 /// Returns the view.
870 /// <since_tizen> 6 </since_tizen>
871 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
872 [EditorBrowsable(EditorBrowsableState.Never)]
873 public View ItemView { get; }
875 internal bool IsBound { get; set; }