Class CompositeFocusRouter
Owns a composite's input-focus model: which menu child currently holds input, cross-menu traversal between stacked menus (up/down at their first/last option, wrapping or stopping at the ends), the SWITCHER content-vs-nav-rail focus split, and the ancestor input-suppression gate. Extracted from UnityCompositeUiView so the focus rules are one plain, testable collaborator reading the composite's state through deferred providers; the view delegates its focus members here.
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Views
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public sealed class CompositeFocusRouter
Constructors
CompositeFocusRouter(Func<IReadOnlyList<IViewBase>>, Func<ContainerContentMode>, Func<string>)
Creates the router over its composite's state.
Declaration
public CompositeFocusRouter(Func<IReadOnlyList<IViewBase>> children, Func<ContainerContentMode> contentMode, Func<string> activeChildId)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IReadOnlyList<IViewBase>> | children | Provides the composite's children in layout order. |
| Func<ContainerContentMode> | contentMode | Provides the composite's content mode (stack vs switcher). |
| Func<string> | activeChildId | Provides the switcher's currently active child id. |
Properties
CrossMenuNavigation
Whether cross-menu focus traversal is configured on.
Declaration
public bool CrossMenuNavigation { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
ConfigureCrossMenu(bool, bool)
Enables cross-menu focus traversal between the STACK's menu children.
Declaration
public void ConfigureCrossMenu(bool enabled, bool wrapAround)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled | Whether traversal is on. |
| bool | wrapAround | Whether traversal wraps the whole stack vs stops at the ends. |
GetInputView()
The leaf menu this composite currently routes input to, or null when it routes none (input then falls back to the menu service's current view, or to a nested composite found separately). A cross-menu STACK returns its focused menu; a SWITCHER returns its active child only when that child is a menu AND content currently holds input.
Declaration
public IViewBase GetInputView()
Returns
| Type | Description |
|---|---|
| IViewBase | The focused leaf menu as an IViewBase, or null. |
InitStackFocus()
Initializes cross-menu focus when a STACK is shown: records the first menu as focused and routes input to it. The actual highlight is applied by each menu's show sequence (which honours the input-active gate), so non-focused siblings don't light up.
Declaration
public void InitStackFocus()
SetContentFocus(bool)
Sets whether a SWITCHER's content (vs a sibling nav rail) holds input, and propagates the resulting input gate to the active child.
Declaration
public void SetContentFocus(bool hasFocus)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | hasFocus | True when the active content child should receive input. |
SetInputActive(bool)
Sets whether this composite's subtree may receive input. An ancestor (e.g. a SWITCHER whose nav rail holds focus) calls this to suppress its inactive content. Re-propagates to the focused child.
Declaration
public void SetInputActive(bool active)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | active | True to allow input within this subtree. |
TryMoveFocus(IFocusableMenuView, bool)
Moves input focus from current to the adjacent sibling menu in the stack —
forward (down past the last option) or backward (up past the first). Wraps the whole stack in
wrap mode; returns false at the stack end in stop mode.
Declaration
public bool TryMoveFocus(IFocusableMenuView current, bool forward)
Parameters
| Type | Name | Description |
|---|---|---|
| IFocusableMenuView | current | The menu focus is leaving. |
| bool | forward | True for downward/next, false for upward/previous. |
Returns
| Type | Description |
|---|---|
| bool | True when focus moved (or wrapped); false to stop at the boundary. |