Esempio n. 1
0
        public void clearItems()
        {
            if (_items.Count == 0)
            {
                return;
            }

            _items.Clear();
            _selection.clear();
            invalidateHierarchy();
        }
Esempio n. 2
0
 /// <summary>
 /// Sets the selection to only the passed item, if it is a possible choice.
 /// </summary>
 /// <returns>The selected.</returns>
 /// <param name="item">Item.</param>
 public void setSelected(T item)
 {
     if (_items.Contains(item))
     {
         _selection.set(item);
     }
     else if (_selection.getRequired() && _items.Count > 0)
     {
         _selection.set(_items[0]);
     }
     else
     {
         _selection.clear();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Sets the selection to only the passed item, if it is a possible choice.
        /// </summary>
        /// <param name="item">Item.</param>
        public ListBox <T> setSelected(T item)
        {
            if (_items.Contains(item))
            {
                _selection.set(item);
            }
            else if (_selection.getRequired() && _items.Count > 0)
            {
                _selection.set(_items[0]);
            }
            else
            {
                _selection.clear();
            }

            return(this);
        }