ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroup.GetPreviousFocusItem C# (CSharp) Method

GetPreviousFocusItem() public method

Gets the previous focus item based on the current item as provided.
public GetPreviousFocusItem ( ViewBase current, bool &matched ) : ViewBase
current ViewBase The view that is currently focused.
matched bool Has the current focus item been matched yet.
return ViewBase
        public ViewBase GetPreviousFocusItem(ViewBase current, ref bool matched)
        {
            ViewBase view = null;

            if (Collapsed)
            {
                if (matched)
                    view = _layoutCollapsedMain;
                else
                    matched = (current == _layoutCollapsedMain);
            }
            else
                view = _layoutNormalContent.GetPreviousFocusItem(current, ref matched);

            return view;
        }

Usage Example

Example #1
0
        /// <summary>
        /// Set focus to the previous focus item inside the popup group.
        /// </summary>
        public void SetPreviousFocusItem()
        {
            // Find the previous item in sequence
            bool     matched = false;
            ViewBase view    = _viewGroup.GetPreviousFocusItem(ViewPopupManager.FocusView, ref matched);

            // Rotate around to the last item
            if (view == null)
            {
                SetLastFocusItem();
            }
            else
            {
                ViewPopupManager.FocusView = view;
                PerformNeedPaint(false);
            }
        }