/// <summary>
 /// Invokes selection of specified dropdown data.
 /// </summary>
 public void SelectData(DropdownData data)
 {
     if (IsSelectionMenu)
     {
         Selection = data;
     }
     OnSelection?.Invoke(data);
 }
        /// <summary>
        /// Imports data from specified enum.
        /// </summary>
        public void ImportFromEnum <T>(T initialValue = default)
            where T : Enum
        {
            Clear();

            foreach (var type in (T[])Enum.GetValues(typeof(T)))
            {
                DropdownData data = new DropdownData(type.ToString(), type);
                Datas.Add(data);

                if (type.Equals(initialValue))
                {
                    SelectData(data);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Sets up the dropdown item using specified data.
 /// </summary>
 public void Setup(DropdownData data, bool isSelected)
 {
     this.Data  = data;
     IsFocused  = isSelected;
     label.Text = data.Text;
 }