Exemplo n.º 1
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();
     }
 }
Exemplo n.º 2
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);
        }