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

            _items.Clear();
            _selection.clear();
            invalidateHierarchy();
        }
Ejemplo 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();
     }
 }
Ejemplo 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);
        }