ClassRadVirtualKeyboardElement
The main element in the RadVirtualKeyboard control that hosts all elements, logic, properties, methods and events for the virtual keyboard functionality.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadVirtualKeyboardElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider, IUpdateKeysListener, IKeyboardLayoutUpdatedListener, IKeyPressedListener, IVirtualKeyboardKeyInputSender
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadVirtualKeyboardElement
Implements:
Inherited Members
Constructors
RadVirtualKeyboardElement()
Initializes a new instance of the RadVirtualKeyboardElement class with default settings and registers event listeners.
Declaration
public RadVirtualKeyboardElement()
Properties
ClickSoundStream
Gets or sets the audio stream used for key press sounds. Returns the default sound if no custom stream is set.
CurrentCulture
Gets or sets the culture used for keyboard layout and key text generation.
Declaration
public CultureInfo CurrentCulture { get; set; }
Property Value
IsAltActive
Gets a value indicating whether the Alt modifier key is currently in active state.
IsAltGrActive
Gets a value indicating whether the AltGr (right Alt) modifier key is currently in active state.
IsCapsLockOn
Gets a value indicating whether the CapsLock key is currently active system-wide.
IsControlActive
Gets a value indicating whether the Control modifier key is currently in active state.
IsNumLockActive
Gets a value indicating whether the NumLock key is currently in active state.
IsNumLockOn
Gets a value indicating whether the NumLock key is currently active system-wide.
IsScrollLockOn
Gets a value indicating whether the ScrollLock key is currently active system-wide.
IsShiftActive
Gets a value indicating whether the Shift modifier key is currently in active state.
IsWindowsKeyActive
Gets a value indicating whether the Windows modifier key is currently in active state.
KeyboardLayoutUpdatedListenersList
Gets the collection of objects that implement IKeyboardLayoutUpdatedListener and will be notified when keyboard layout or language changes.
Declaration
public static IList<IKeyboardLayoutUpdatedListener> KeyboardLayoutUpdatedListenersList { get; }
Property Value
LanguageCheckTimer
Gets the timer that periodically checks for system language changes and notifies listeners when changes occur.
LayoutType
Gets or sets the keyboard layout type which determines the arrangement and availability of keys on the virtual keyboard.
Declaration
public KeyboardLayoutType LayoutType { get; set; }
Property Value
MainLayoutPanel
Gets or sets the main layout panel that hosts and arranges the keyboard layouts and key elements.
Declaration
public VirtualKeyboardLayoutPanel MainLayoutPanel { get; set; }
Property Value
ModifierKeys
Gets the collection of virtual key codes for currently active modifier keys.
PreventPopupsAutoClose
Gets or sets a value indicating whether the RadVirtualKeyboard should intercept system mouse clicks on its surface before they are processed by other application pop-ups, context menus, drop-downs, or any other elements that are automatically closed when you click outside of their surface. This prevents these UI elements from closing unexpectedly when users interact with the virtual keyboard, ensuring a seamless typing experience in touch-enabled scenarios.
Declaration
public static bool PreventPopupsAutoClose { get; set; }
Property Value
true if the virtual keyboard should intercept system mouse events; otherwise, false.
The default value is true.
Remarks
When enabled, this feature intercepts system-wide mouse events before they reach other applications. This is particularly important when the RadVirtualKeyboard is used alongside pop-up windows, context menus, or drop-down controls that would normally close when receiving mouse events outside their boundaries. By intercepting these events, the virtual keyboard prevents unintended closures and maintains a consistent user experience.
Note: Enabling this feature disables the repeat button functionality of virtual keyboard keys.
Disabling this feature may result in pop-ups, context menus, and drop-down controls closing unexpectedly when users interact with the virtual keyboard.
ScaleFontOnResize
Gets or sets a value indicating whether the font size should be automatically scaled when the control size changes.
Declaration
public bool ScaleFontOnResize { get; set; }
Property Value
Implements
SynchronizeCultureWithSystem
Gets or sets a value indicating whether the virtual keyboard will automatically synchronize with system language changes.
Declaration
public bool SynchronizeCultureWithSystem { get; set; }
Property Value
UpdateKeysListenersList
Gets the collection of objects that implement IUpdateKeysListener and will be notified when CapsLock, NumLock or ScrollLock state changes.
Declaration
public static IList<IUpdateKeysListener> UpdateKeysListenersList { get; }
Property Value
IList<IUpdateKeysListener>
UseClickSound
Gets or sets a value indicating whether a click sound should be played when keys are pressed.
Methods
DisposeManagedResources()
Releases all managed resources used by the RadVirtualKeyboardElement and removes event listeners.
Declaration
protected override void DisposeManagedResources()
Overrides
GetLayoutPanelByLayoutType(KeyboardLayoutType)
Returns a VirtualKeyboardLayoutPanel instance with predefined keyboard layout based on the specified layout type.
Declaration
protected virtual VirtualKeyboardLayoutPanel GetLayoutPanelByLayoutType(KeyboardLayoutType value)
Parameters
value
The keyboard layout type to create a panel for.
Returns
A new VirtualKeyboardLayoutPanel instance configured for the specified layout type.
GetTextFromKeyInfo(KeyInfo)
Extracts the appropriate text representation from a KeyInfo object based on current modifier key states.
InitializeFields()
Initializes member fields to their default values during element construction.
Declaration
protected override void InitializeFields()
Overrides
OnKeyPressed(Keys)
Handles key press events from the system and updates lock key states accordingly.
Declaration
public void OnKeyPressed(Keys key)
Parameters
key
The key that was pressed.
Implements
OnKeyboardLayoutChanged(VirtualKeyboardLayoutChangedEventArgs)
Raises the KeyboardLayoutChanged event with the specified event arguments.
Declaration
protected virtual void OnKeyboardLayoutChanged(VirtualKeyboardLayoutChangedEventArgs e)
Parameters
e
VirtualKeyboardLayoutChangedEventArgs
The event arguments containing layout change information.
OnLoaded()
Called when the element has been successfully loaded including all its children.
Declaration
protected override void OnLoaded()
Overrides
OnVirtualKeySending(VirtualKeyboardKeySendingEventArgs)
Raises the KeySending event with the specified event arguments.
Declaration
protected virtual void OnVirtualKeySending(VirtualKeyboardKeySendingEventArgs e)
Parameters
e
VirtualKeyboardKeySendingEventArgs
The event arguments containing key sending information.
OnVirtualKeySent(VirtualKeyboardKeySentEventArgs)
Raises the KeySent event with the specified event arguments and plays the click sound if enabled.
Declaration
protected virtual void OnVirtualKeySent(VirtualKeyboardKeySentEventArgs e)
Parameters
e
VirtualKeyboardKeySentEventArgs
The event arguments containing key sent information.
PlaySound()
Plays the configured click sound if UseClickSound is enabled.
Declaration
protected virtual void PlaySound()
Send(IKey, Keys)
Sends a key input using the specified Keys enumeration value to the focused application.
Send(IKey, char)
Sends a character input to the focused application.
Send(IKey, int)
Sends a key input using the specified virtual key code to the focused application.
Send(IKey, string)
Sends text input to the focused application.
SendCore(IKey, KeySendContext, int?, string)
Core implementation for sending key input with support for both virtual key codes and text.
Declaration
protected virtual void SendCore(IKey sender, KeySendContext context, int? virtualKey = null, string text = null)
Parameters
sender
The key instance that initiated the send operation.
context
The context indicating whether to send as virtual key or text.
virtualKey
int?
The virtual key code when sending as virtual key.
text
The text when sending as text.
UpdateKeyboardLayout(CultureInfo)
Handles keyboard layout changes from the system and updates the virtual keyboard accordingly.
Declaration
public void UpdateKeyboardLayout(CultureInfo culture)
Parameters
culture
The new culture information representing the changed keyboard layout.
Implements
UpdateKeys()
Updates the text and appearance of all keys in the virtual keyboard based on the current culture and modifier key states.
Declaration
public void UpdateKeys()
Implements
UpdateKeysListeners()
Notifies all registered listeners when CapsLock, NumLock or ScrollLock state changes.
Declaration
public static void UpdateKeysListeners()
UpdateModifierKeys(IKey)
Updates the visual state of modifier and lock keys based on the current keyboard state.
Declaration
protected virtual void UpdateModifierKeys(IKey key)
Parameters
key
The key to update the state for.
Events
KeySending
Occurs before a key is sent to the target application, allowing cancellation or modification of the key operation.
Declaration
public event VirtualKeyboardKeySendingEventHandler KeySending
Event Value
KeySent
Occurs after a key has been successfully sent to the target application.
Declaration
public event VirtualKeyboardKeySentEventHandler KeySent
Event Value
KeyboardLayoutChanged
Occurs when the keyboard layout or culture changes, providing information about the old and new cultures.
Declaration
public event VirtualKeyboardLayoutChangedEventHandler KeyboardLayoutChanged
Event Value