ComponentBehavior
Manages behavioral aspects of RadControl components including input handling, element selection, keyboard navigation, tooltips, and visual feedback mechanisms.
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
public class ComponentBehavior : IDisposable
Inheritance: objectComponentBehavior
Derived Classes:
Implements:
Constructors
Initializes a new instance of the ComponentBehavior class for the specified component tree handler.
public ComponentBehavior(IComponentTreeHandler owner)
The IComponentTreeHandler that owns this behavior instance.
The constructor establishes the relationship between the behavior manager and its owner component, enabling the behavior to manage input, focus, and visual state for the associated control and its element tree.
Fields
protected bool ItemCaptureState
Properties
Indicates focus cues display, when available, based on the corresponding control type and the current UI state.
public virtual bool AllowShowFocusCues { get; set; }
public FillRepository BitmapRepository { get; }
[TypeConverter(typeof(ExpandableObjectConverter))]
public InputBindingsCollection CommandBindings { get; }
protected virtual bool DefaultShowItemToolTips { get; }
Gets or sets whether Key Map (Office 2007 like accelerator keys map) is used for this specific control. Currently this option is implemented for the RadRibbonBar control only.
[Browsable(true)]
public bool EnableKeyMap { get; set; }
Gets or sets the currently focused RadElement within the component tree.
[Browsable(false)]
public RadElement FocusedElement { get; set; }
The RadElement that currently has input focus, or null if no element is focused.
Setting this property to a specific element will give focus to that element and remove focus
from any previously focused element. Setting it to null will remove focus from the
currently focused element. This property coordinates with the focus management system to
ensure proper focus state handling throughout the element tree.
Gets whether this instance of RadControl is on a active form
protected bool IsParentFormActive { get; }
Determines whether the mouse over the owning IComponentTreeHandler instance.
public bool MouseOver { get; }
protected IComponentTreeHandler Owner { get; }
[Browsable(false)]
protected Control OwnerControl { get; }
Gets the current selected element (hovered by the mouse).
[Browsable(false)]
public RadElement SelectedElement { get; }
Gets or sets a value indicating whether ToolTips are shown for the RadItem objects contained in the RadControl.
public bool ShowItemToolTips { get; set; }
Gets or sets value indicating whether the control should show all screen tips under the control client rectangle, as required for the RibbonBar control, for example
public bool ShowScreenTipsBellowControl { get; set; }
Gets the ToolTip instance used to display element tooltips within the component.
public ToolTip ToolTip { get; }
A ToolTip instance that handles tooltip display for elements within the component tree. The property creates a RadToolTip instance on first access if one doesn't already exist.
The tooltip is lazily created when first accessed. If the component has a valid element tree with a root element, a RadToolTip is created with that root element as context. Otherwise, a default RadToolTip instance is created.
This tooltip is used throughout the component to display contextual help text for elements that have their ToolTipText property set.
Gets or sets the value of how much the tooltip will be moved on the X coordinate
public int ToolTipOffsetX { get; set; }
Gets or sets the value of how much the tooltip will be moved on the Y coordinate
public int ToolTipOffsetY { get; set; }
Methods
Releases all resources used by the ComponentBehavior instance.
public void Dispose()
Implements:
This method cleans up managed resources including element references, keyboard mappings, tooltips, screen tip presenters, and shortcut collections. It follows the standard .NET disposal pattern and suppresses finalization.
protected virtual void DisposeAdornerLayer()
Clears all resources reserved for the KeyTips functionality
protected virtual void DisposeKeyTips()
protected RadItem GetActivatedItem(RadElement element, char charCode)
public void HideScreenTip()
protected virtual void InitializeAdornerLayer()
protected virtual void InitializeKeyMap()
Checks is a given element or any of its descendants contain the focus.
public bool IsFocusWithin(RadElement element)
The element.
Returns:[true] if the element or any of its children contain focus, [false] otherwise.
protected virtual void OnEnableKeyTipsChanged()
Handles the event that occurs when the control receives focus, restoring focus to the last focused element.
public virtual bool OnGotFocus(EventArgs e)
An EventArgs that contains the event data.
Returns:true if the event is handled; otherwise, false.
This method is called when the owner control gains focus. It attempts to restore focus to the element that was previously focused before the control lost focus, maintaining focus continuity for improved user experience.
If a last focused element exists and is not disposed, it becomes the current focused element and receives input focus. The last focused element reference is then cleared.
Handles the event that occurs when the control loses focus, preserving the focus state for later restoration.
public virtual bool OnLostFocus(EventArgs e)
An EventArgs that contains the event data.
Returns:true if the event is handled; otherwise, false.
This method is called when the owner control loses focus. It removes focus from the currently focused element and stores a reference to it for later restoration when the control regains focus.
Additionally, if keyboard mapping (key tips) is active, this method resets the key map state to ensure proper cleanup when focus is lost.
protected virtual void ResetKeyMap()
protected virtual void ResetKeyMapInternal()
public void SetElementValue(RadElement element, RadProperty dependencyProperty, object value)