/// <summary> /// Gets the next focus item based on the current item as provided. /// </summary> /// <param name="current">The view that is currently focused.</param> /// <param name="matched">Has the current focus item been matched yet.</param> /// <returns>ViewBase of item; otherwise false.</returns> public ViewBase GetNextFocusItem(ViewBase current, ref bool matched) { ViewBase view = null; // Scan all the children, which must be containers foreach (ViewBase child in this) { // Only interested in visible children! if (child.Visible) { // Is this a container item if (child is IRibbonViewGroupContainerView) { // Cast to correct type IRibbonViewGroupContainerView container = (IRibbonViewGroupContainerView)child; // Already matched means we need the next item we come across, // otherwise we continue with the attempt to find next if (matched) { view = container.GetFirstFocusItem(); } else { view = container.GetNextFocusItem(current, ref matched); } if (view != null) { break; } } else if (child is IRibbonViewGroupItemView) { // Cast to correct type IRibbonViewGroupItemView item = (IRibbonViewGroupItemView)child; // Already matched means we need the next item we come across, // otherwise we continue with the attempt to find next if (matched) { view = item.GetFirstFocusItem(); } else { view = item.GetNextFocusItem(current, ref matched); } if (view != null) { break; } } } } return(view); }
/// <summary> /// Gets the next focus item based on the current item as provided. /// </summary> /// <param name="current">The view that is currently focused.</param> /// <param name="matched">Has the current focus item been matched yet.</param> /// <returns>ViewBase of item; otherwise false.</returns> public ViewBase GetNextFocusItem(ViewBase current, ref bool matched) { ViewBase view = null; // Scan all the children, which must be containers foreach (ViewBase child in this) { // Only interested in visible children! if (child.Visible) { if (child is IRibbonViewGroupItemView) { // Cast to correct type IRibbonViewGroupItemView item = (IRibbonViewGroupItemView)child; // If already matched, then we need to next item we find, // otherwise we are still looking for the next item if (matched) { view = item.GetFirstFocusItem(); } else { view = item.GetNextFocusItem(current, ref matched); } if (view != null) { break; } } } } return(view); }