Exemplo n.º 1
0
 public int IndexOf(T item)
 {
     try
     {
         var lvi = BaseItemsEnumerable.Where(x => x.Tag == item).First();
         return(BaseItems.IndexOf(lvi));
     }
     catch (Exception)
     {
         return(-1);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Focuses the next item.
 /// </summary>
 /// <param name="item">The current item.</param>
 /// <param name="forward">if set to <c>true</c>, moves to the next item, otherwise moves to the previous item.</param>
 /// <returns><c>true</c> on success, <c>false</c> otherwise.</returns>
 protected bool FocusNextItem(ButtonListItem <T> item, bool forward)
 {
     if (BaseItems.Count > 0)
     {
         var idx = -1;
         if (item != null && (idx = BaseItems.IndexOf(item)) == -1)
         {
             throw new ArgumentOutOfRangeException(nameof(item));
         }
         idx = GetNextEnabledItemIndex(idx, forward);
         if (idx != -1)
         {
             SetFocused(idx);
             return(true);
         }
     }
     return(false);
 }