Class
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:

cs-api-definition
public class ComponentBehavior : IDisposable

Inheritance: objectComponentBehavior

Derived Classes: ComponentInputBehavior

Implements: IDisposable

Constructors

ComponentBehavior(IComponentTreeHandler)

Initializes a new instance of the ComponentBehavior class for the specified component tree handler.

Declaration

cs-api-definition
public ComponentBehavior(IComponentTreeHandler owner)

Parameters

owner

IComponentTreeHandler

The IComponentTreeHandler that owns this behavior instance.

Remarks

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

ItemCaptureState

Declaration

cs-api-definition
protected bool ItemCaptureState

Field Value

bool

Properties

AllowShowFocusCues

Indicates focus cues display, when available, based on the corresponding control type and the current UI state.

Declaration

cs-api-definition
public virtual bool AllowShowFocusCues { get; set; }

Property Value

bool

BitmapRepository

Declaration

cs-api-definition
public FillRepository BitmapRepository { get; }

Property Value

FillRepository

CommandBindings

Declaration

cs-api-definition
[TypeConverter(typeof(ExpandableObjectConverter))]
public InputBindingsCollection CommandBindings { get; }

Property Value

InputBindingsCollection

DefaultShowItemToolTips

Declaration

cs-api-definition
protected virtual bool DefaultShowItemToolTips { get; }

Property Value

bool

EnableKeyMap

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.

Declaration

cs-api-definition
[Browsable(true)]
public bool EnableKeyMap { get; set; }

Property Value

bool

FocusedElement

Gets or sets the currently focused RadElement within the component tree.

Declaration

cs-api-definition
[Browsable(false)]
public RadElement FocusedElement { get; set; }

Property Value

RadElement

The RadElement that currently has input focus, or null if no element is focused.

Remarks

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.

IsParentFormActive

Gets whether this instance of RadControl is on a active form

Declaration

cs-api-definition
protected bool IsParentFormActive { get; }

Property Value

bool

MouseOver

Determines whether the mouse over the owning IComponentTreeHandler instance.

Declaration

cs-api-definition
public bool MouseOver { get; }

Property Value

bool

Owner

Declaration

cs-api-definition
protected IComponentTreeHandler Owner { get; }

Property Value

IComponentTreeHandler

OwnerControl

Declaration

cs-api-definition
[Browsable(false)]
protected Control OwnerControl { get; }

Property Value

Control

SelectedElement

Gets the current selected element (hovered by the mouse).

Declaration

cs-api-definition
[Browsable(false)]
public RadElement SelectedElement { get; }

Property Value

RadElement

ShowItemToolTips

Gets or sets a value indicating whether ToolTips are shown for the RadItem objects contained in the RadControl.

Declaration

cs-api-definition
public bool ShowItemToolTips { get; set; }

Property Value

bool

ShowScreenTipsBellowControl

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

Declaration

cs-api-definition
public bool ShowScreenTipsBellowControl { get; set; }

Property Value

bool

ToolTip

Gets the ToolTip instance used to display element tooltips within the component.

Declaration

cs-api-definition
public ToolTip ToolTip { get; }

Property Value

ToolTip

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.

Remarks

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.

ToolTipOffsetX

Gets or sets the value of how much the tooltip will be moved on the X coordinate

Declaration

cs-api-definition
public int ToolTipOffsetX { get; set; }

Property Value

int

ToolTipOffsetY

Gets or sets the value of how much the tooltip will be moved on the Y coordinate

Declaration

cs-api-definition
public int ToolTipOffsetY { get; set; }

Property Value

int

Methods

ActivateSelectedItem(RadItem)

Declaration

cs-api-definition
protected virtual bool ActivateSelectedItem(RadItem currentKeyMapItem)

Parameters

currentKeyMapItem

RadItem

Returns

bool

Dispose()

Releases all resources used by the ComponentBehavior instance.

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

Remarks

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.

Dispose(bool)

Declaration

cs-api-definition
protected virtual void Dispose(bool disposing)

Parameters

disposing

bool

DisposeAdornerLayer()

Declaration

cs-api-definition
protected virtual void DisposeAdornerLayer()

DisposeKeyTips()

Clears all resources reserved for the KeyTips functionality

Declaration

cs-api-definition
protected virtual void DisposeKeyTips()

GetActivatedItem(Control, char)

Declaration

cs-api-definition
protected RadItem GetActivatedItem(Control control, char charCode)

Parameters

control

Control

charCode

char

Returns

RadItem

GetActivatedItem(RadElement, char)

Declaration

cs-api-definition
protected RadItem GetActivatedItem(RadElement element, char charCode)

Parameters

element

RadElement

charCode

char

Returns

RadItem

GetCurrentKeyMap(RadItem)

Declaration

cs-api-definition
public virtual List<RadItem> GetCurrentKeyMap(RadItem currentKeyMapItem)

Parameters

currentKeyMapItem

RadItem

Returns

List<RadItem>

GetKeyFocusChildren(RadItem)

Declaration

cs-api-definition
protected virtual List<RadItem> GetKeyFocusChildren(RadItem currentKeyMapItem)

Parameters

currentKeyMapItem

RadItem

Returns

List<RadItem>

GetKeyMapFocus()

Declaration

cs-api-definition
protected bool GetKeyMapFocus()

Returns

bool

GetKeyStringRepresentation(Keys)

Declaration

cs-api-definition
protected virtual string GetKeyStringRepresentation(Keys input)

Parameters

input

Keys

Returns

string

GetMnemonicText(string)

Declaration

cs-api-definition
protected virtual string GetMnemonicText(string text)

Parameters

text

string

Returns

string

GetRootItems()

Declaration

cs-api-definition
protected virtual List<RadItem> GetRootItems()

Returns

List<RadItem>

GetThemedChildControlsList(Control, List<Control>)

Declaration

cs-api-definition
protected virtual void GetThemedChildControlsList(Control control, List<Control> mnemonicList)

Parameters

control

Control

mnemonicList

List<Control>

GetValidChildControlByMnemonic(List<Control>, char)

Declaration

cs-api-definition
protected virtual Control GetValidChildControlByMnemonic(List<Control> mnemonicList, char charCode)

Parameters

mnemonicList

List<Control>

charCode

char

Returns

Control

HideScreenTip()

Declaration

cs-api-definition
public void HideScreenTip()

InitializeAdornerLayer()

Declaration

cs-api-definition
protected virtual void InitializeAdornerLayer()

InitializeKeyMap()

Declaration

cs-api-definition
protected virtual void InitializeKeyMap()

IsExactMatch(RadItem, string)

Declaration

cs-api-definition
protected virtual bool IsExactMatch(RadItem item, string keyTipFragment)

Parameters

item

RadItem

keyTipFragment

string

Returns

bool

IsFocusWithin(RadElement)

Checks is a given element or any of its descendants contain the focus.

Declaration

cs-api-definition
public bool IsFocusWithin(RadElement element)

Parameters

element

RadElement

The element.

Returns

bool

[true] if the element or any of its children contain focus, [false] otherwise.

IsIndexOfItemKeyTip(RadItem, string)

Declaration

cs-api-definition
protected virtual int IsIndexOfItemKeyTip(RadItem item, string keyTipFragment)

Parameters

item

RadItem

keyTipFragment

string

Returns

int

IsPartOfKeyTip(Keys, string)

Declaration

cs-api-definition
protected virtual bool IsPartOfKeyTip(Keys input, string representation)

Parameters

input

Keys

representation

string

Returns

bool

OnEnableKeyTipsChanged()

Declaration

cs-api-definition
protected virtual void OnEnableKeyTipsChanged()

OnGotFocus(EventArgs)

Handles the event that occurs when the control receives focus, restoring focus to the last focused element.

Declaration

cs-api-definition
public virtual bool OnGotFocus(EventArgs e)

Parameters

e

EventArgs

An EventArgs that contains the event data.

Returns

bool

true if the event is handled; otherwise, false.

Remarks

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.

OnLostFocus(EventArgs)

Handles the event that occurs when the control loses focus, preserving the focus state for later restoration.

Declaration

cs-api-definition
public virtual bool OnLostFocus(EventArgs e)

Parameters

e

EventArgs

An EventArgs that contains the event data.

Returns

bool

true if the event is handled; otherwise, false.

Remarks

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.

ProcessMnemonic(char)

Declaration

cs-api-definition
protected bool ProcessMnemonic(char charCode)

Parameters

charCode

char

Returns

bool

ProcessMnemonicChar(char)

Declaration

cs-api-definition
protected virtual bool ProcessMnemonicChar(char charCode)

Parameters

charCode

char

Returns

bool

ProcessUnmappedItems(List<RadItem>)

Declaration

cs-api-definition
protected virtual int ProcessUnmappedItems(List<RadItem> childrenToBeMapped)

Parameters

childrenToBeMapped

List<RadItem>

Returns

int

ResetKeyMap()

Declaration

cs-api-definition
protected virtual void ResetKeyMap()

ResetKeyMapInternal()

Declaration

cs-api-definition
protected virtual void ResetKeyMapInternal()

ReturnKeyMapFocus()

Declaration

cs-api-definition
protected bool ReturnKeyMapFocus()

Returns

bool

SetElementValue(RadElement, RadProperty, object)

Declaration

cs-api-definition
public void SetElementValue(RadElement element, RadProperty dependencyProperty, object value)

Parameters

element

RadElement

dependencyProperty

RadProperty

value

object

SetInternalKeyMapFocus()

Declaration

cs-api-definition
protected virtual bool SetInternalKeyMapFocus()

Returns

bool

SetKeyMap()

Declaration

cs-api-definition
public virtual bool SetKeyMap()

Returns

bool