Class FocusManager

    Definition

    Namespace:
    Tizen.NUI
    Assembly:
    Tizen.NUI.dll

    Provides the functionality of handling keyboard navigation and maintaining the two-dimensional keyboard focus chain.
    It provides functionality of setting the focus and moving the focus in four directions( i.e., left, right, up, and down).
    It also draws a highlight for the focused view and sends an event when the focus is changed.

    public class FocusManager : BaseHandle, IDynamicResourceHandler, INameScope, System.IDisposable
    Inheritance
    object
    BindableObject
    Element
    BaseHandle
    FocusManager
    Implements
    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Properties

    View Source

    FocusGroupLoop

    Gets or sets the status of whether the focus movement should be looped within the same focus group.
    The focus movement is not looped by default.

    Declaration
    public bool FocusGroupLoop { get; set; }
    Property Value
    Type Description
    bool
    View Source

    FocusIndicator

    Gets or sets the focus indicator view.
    This will replace the default focus indicator view in the FocusManager and will be added to the focused view as a highlight.

    Declaration
    public View FocusIndicator { get; set; }
    Property Value
    Type Description
    View
    View Source

    Instance

    Gets the singleton of the FocusManager object.

    Declaration
    public static FocusManager Instance { get; }
    Property Value
    Type Description
    FocusManager

    Methods

    View Source

    ClearFocus()

    Clears the focus from the current focused view if any, so that no view is focused in the focus chain.
    It will emit the FocusChanged event without the current focused view.

    Declaration
    public void ClearFocus()
    View Source

    Dispose(bool)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    BaseHandle.Dispose(bool)
    View Source

    EnableDefaultAlgorithm(bool)

    Sets to use the automatic focus moveing algorithm.
    It moves the focus to the view closest to the keyboard movement direction.

    Declaration
    public void EnableDefaultAlgorithm(bool enable)
    Parameters
    Type Name Description
    bool enable

    Whether using default focus algorithm or not

    View Source

    EnableFocusIndicator(bool)

    Decide using focus indicator or not

    Declaration
    public void EnableFocusIndicator(bool enable)
    Parameters
    Type Name Description
    bool enable

    Whether using focus indicator or not

    View Source

    GetCurrentFocusView()

    Gets the current focused view.

    Declaration
    public View GetCurrentFocusView()
    Returns
    Type Description
    View

    A handle to the current focused view or an empty handle if no view is focused.

    View Source

    GetDefaultFocusIndicator()

    Get a default focus indicator

    Declaration
    public View GetDefaultFocusIndicator()
    Returns
    Type Description
    View

    instance of default focus indicator

    Remarks

    The type actually ImageView of blue border squred png image, so it would be difficult to modify itself. To change focus indicator, creating new indicator and assigning it to FocusIndicator are recommended. For example,

    FocusManager.Instance.FocusIndicator = new View()
    {
        PositionUsesPivotPoint = true,
        PivotPoint = new Position(0, 0, 0),
        WidthResizePolicy = ResizePolicyType.FillToParent,
        HeightResizePolicy = ResizePolicyType.FillToParent,
        BorderlineColor = Color.Orange,
        BorderlineWidth = 4.0f,
        BorderlineOffset = -1f,
        BackgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.2f),
    };
    View Source

    GetFocusGroup(View)

    Returns the closest ancestor of the given view that is a focus group.

    Declaration
    public View GetFocusGroup(View view)
    Parameters
    Type Name Description
    View view

    The view to be checked for its focus group.

    Returns
    Type Description
    View

    The focus group the given view belongs to or an empty handle if the given view.

    View Source

    GetNearestFocusableActor(View, View, FocusDirection)

    Get the nearest focusable view.

    Declaration
    public View GetNearestFocusableActor(View rootView, View focusedView, View.FocusDirection direction)
    Parameters
    Type Name Description
    View rootView

    The view group in which to find the next focusable view.

    View focusedView

    The current focused view.

    View.FocusDirection direction

    The direction.

    Returns
    Type Description
    View

    The nearest focusable view, or an empty handle if none exists.

    View Source

    IsDefaultAlgorithmEnabled()

    Checks default focus moveing algorithm is enabled or not

    Declaration
    public bool IsDefaultAlgorithmEnabled()
    Returns
    Type Description
    bool

    Whether default focus algorithm is enabled

    View Source

    IsFocusGroup(View)

    Checks whether the view is set as a focus group or not.

    Declaration
    public bool IsFocusGroup(View view)
    Parameters
    Type Name Description
    View view

    The view to be checked.

    Returns
    Type Description
    bool

    Whether the view is set as a focus group.

    View Source

    IsFocusIndicatorEnabled()

    Check focus indicator is enabled or not

    Declaration
    public bool IsFocusIndicatorEnabled()
    Returns
    Type Description
    bool

    Whether focus indicator is enabled

    View Source

    MoveFocus(FocusDirection)

    Moves the focus to the next focusable view in the focus chain in the given direction (according to the focus traversal order).

    Declaration
    public bool MoveFocus(View.FocusDirection direction)
    Parameters
    Type Name Description
    View.FocusDirection direction

    The direction of the focus movement.

    Returns
    Type Description
    bool

    True if the movement was successful.

    View Source

    MoveFocusBackward()

    Move the focus to previous focused view.

    Declaration
    public void MoveFocusBackward()
    View Source

    ResetFocusFinderRootView()

    Reset the root view that starts moving focus when DefaultAlgorithm is enabled. When reset, the window becomes root.

    Declaration
    public void ResetFocusFinderRootView()
    View Source

    SetAsFocusGroup(View, bool)

    Sets whether the view is a focus group that can limit the scope of the focus movement to its child views in the focus chain.
    Layout controls set themselves as focus groups by default.

    Declaration
    public void SetAsFocusGroup(View view, bool isFocusGroup)
    Parameters
    Type Name Description
    View view

    The view to be set as a focus group.

    bool isFocusGroup

    Whether to set the view as a focus group or not.

    View Source

    SetCurrentFocusView(View)

    Moves the keyboard focus to the given view.
    Only one view can be focused at the same time.
    The view must be in the stage already and keyboard focusable.

    Declaration
    public bool SetCurrentFocusView(View view)
    Parameters
    Type Name Description
    View view

    The view to be focused.

    Returns
    Type Description
    bool

    Whether the focus is successful or not.

    View Source

    SetCustomAlgorithm(ICustomFocusAlgorithm)

    Provides the implementation of a custom focus algorithm interface to allow the application to define the focus logic.

    Declaration
    public void SetCustomAlgorithm(FocusManager.ICustomFocusAlgorithm arg0)
    Parameters
    Type Name Description
    FocusManager.ICustomFocusAlgorithm arg0

    The user's implementation of ICustomFocusAlgorithm.

    View Source

    SetFocusFinderRootView(View)

    Sets the root view to start moving focus when DefaultAlgorithm is enabled. This will only look for focusable Views within that View tree when looking for the next focus.

    Declaration
    public void SetFocusFinderRootView(View rootView)
    Parameters
    Type Name Description
    View rootView

    The root view in which to find the next focusable view.

    Events

    View Source

    FocusChanged

    The FocusChanged will be triggered after the current focused view has been changed.

    Declaration
    public event EventHandler<FocusManager.FocusChangedEventArgs> FocusChanged
    Event Type
    Type Description
    EventHandler<><FocusChangedEventArgs>
    View Source

    FocusChanging

    FocusChanging will be triggered before the focus is going to be changed.
    The FocusManager makes the best guess for which view to focus towards the given direction, but applications might want to change that.
    By connecting with this event, they can check the proposed view to focus and assign a different view if they wish.
    This event is only triggered when the navigation key is pressed and FocusManager tries to move the focus automatically.
    It won't be emitted for focus movement by calling the SetCurrentFocusView directly.

    Declaration
    public event EventHandler<FocusChangingEventArgs> FocusChanging
    Event Type
    Type Description
    EventHandler<><FocusChangingEventArgs>
    Remarks

    By setting FocusChangingEventArgs.Proposed with the view to be focused, the focus will be moved to the assigned view.

    View Source

    FocusedViewActivated

    The FocusedViewActivated will be triggered when the current focused view has the enter key pressed on it.

    Declaration
    public event EventHandler<FocusManager.FocusedViewActivatedEventArgs> FocusedViewActivated
    Event Type
    Type Description
    EventHandler<><FocusedViewActivatedEventArgs>
    View Source

    FocusedViewEnterKeyPressed

    [Obsolete("Do not use this, that will be deprecated.")]

    Declaration
    public event EventHandler<FocusManager.FocusedViewActivatedEventArgs> FocusedViewEnterKeyPressed
    Event Type
    Type Description
    EventHandler<><FocusedViewActivatedEventArgs>
    View Source

    FocusGroupChanged

    The FocusGroupChanged will be triggered when the focus group has been changed.
    If the current focus group has a parent layout control, the FocusManager will make the best guess for the next focus group to move the focus to in the given direction (forward or backward).
    If not, the application has to set the new focus.

    Declaration
    public event EventHandler<FocusManager.FocusGroupChangedEventArgs> FocusGroupChanged
    Event Type
    Type Description
    EventHandler<><FocusGroupChangedEventArgs>
    View Source

    PreFocusChange

    PreFocusChange will be triggered before the focus is going to be changed.
    The FocusManager makes the best guess for which view to focus towards the given direction, but applications might want to change that.
    By connecting with this event, they can check the proposed view to focus and return a different view if they wish.
    This event is only triggered when the navigation key is pressed and KeyboardFocusManager tries to move the focus automatically.
    It won't be emitted for focus movement by calling the SetCurrentFocusView directly.

    Declaration
    public event EventHandlerWithReturnType<object, FocusManager.PreFocusChangeEventArgs, View> PreFocusChange
    Event Type
    Type Description
    EventHandlerWithReturnType<object, FocusManager.PreFocusChangeEventArgs, View>

    Implements

    IDynamicResourceHandler
    INameScope
    System.IDisposable

    Extension Methods

    BindableObjectExtensions.SetBinding(BindableObject, BindableProperty, string, BindingMode, IValueConverter, string)
    NameScopeExtensions.FindByName<T>(Element, string)
    EXamlExtensions.LoadFromEXamlByRelativePath<T>(T, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, string)
    Extensions.LoadFromXaml<TXaml>(TXaml, Type)
    Extensions.LoadFromXamlFile<TXaml>(TXaml, string)
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX