Class RadVirtualKeyboardElement
The main element in the RadVirtualKeyboard control that hosts all elements, logic, properties, methods and events for the virtual keyboard functionality.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadVirtualKeyboardElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider, IUpdateKeysListener, IKeyboardLayoutUpdatedListener, IKeyPressedListener, IVirtualKeyboardKeyInputSender
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.
Declaration
public Stream ClickSoundStream { get; set; }
Property Value
|
System.IO.Stream
|
CurrentCulture
Gets or sets the culture used for keyboard layout and key text generation.
Declaration
public CultureInfo CurrentCulture { get; set; }
Property Value
|
System.Globalization.CultureInfo
|
IsAltActive
Gets a value indicating whether the Alt modifier key is currently in active state.
Declaration
public bool IsAltActive { get; }
Property Value
|
System.Boolean
|
IsAltGrActive
Gets a value indicating whether the AltGr (right Alt) modifier key is currently in active state.
Declaration
public bool IsAltGrActive { get; }
Property Value
|
System.Boolean
|
IsCapsLockOn
Gets a value indicating whether the CapsLock key is currently active system-wide.
Declaration
public static bool IsCapsLockOn { get; }
Property Value
|
System.Boolean
|
IsControlActive
Gets a value indicating whether the Control modifier key is currently in active state.
Declaration
public bool IsControlActive { get; }
Property Value
|
System.Boolean
|
IsNumLockActive
Gets a value indicating whether the NumLock key is currently in active state.
Declaration
public bool IsNumLockActive { get; }
Property Value
|
System.Boolean
|
Implements
IsNumLockOn
Gets a value indicating whether the NumLock key is currently active system-wide.
Declaration
public static bool IsNumLockOn { get; }
Property Value
|
System.Boolean
|
IsScrollLockOn
Gets a value indicating whether the ScrollLock key is currently active system-wide.
Declaration
public static bool IsScrollLockOn { get; }
Property Value
|
System.Boolean
|
IsShiftActive
Gets a value indicating whether the Shift modifier key is currently in active state.
Declaration
public bool IsShiftActive { get; }
Property Value
|
System.Boolean
|
Implements
IsWindowsKeyActive
Gets a value indicating whether the Windows modifier key is currently in active state.
Declaration
public bool IsWindowsKeyActive { get; }
Property Value
|
System.Boolean
|
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
|
System.Collections.Generic.IList<IKeyboardLayoutUpdatedListener>
|
LanguageCheckTimer
Gets the timer that periodically checks for system language changes and notifies listeners when changes occur.
Declaration
public static Timer LanguageCheckTimer { get; }
Property Value
|
System.Windows.Forms.Timer
|
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
|
KeyboardLayoutType
|
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
|
VirtualKeyboardLayoutPanel
|
ModifierKeys
Gets the collection of virtual key codes for currently active modifier keys.
Declaration
public List<int> ModifierKeys { get; }
Property Value
|
System.Collections.Generic.List<System.Int32>
|
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
|
System.Boolean
|
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
|
System.Boolean
|
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
|
System.Boolean
|
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
|
System.Collections.Generic.IList<IUpdateKeysListener>
|
UseClickSound
Gets or sets a value indicating whether a click sound should be played when keys are pressed.
Declaration
public bool UseClickSound { get; set; }
Property Value
|
System.Boolean
|
Methods
DisposeManagedResources()
Releases all managed resources used by the RadVirtualKeyboardElement and removes event listeners.
Declaration
protected override void DisposeManagedResources()
Overrides
DoKeyDown(KeyEventArgs)
This method is not relevant for this element.
Declaration
protected override void DoKeyDown(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
|
Overrides
DoKeyPress(KeyPressEventArgs)
This method is not relevant for this element.
Declaration
protected override void DoKeyPress(KeyPressEventArgs e)
Parameters
|
System.Windows.Forms.KeyPressEventArgs
e
|
Overrides
DoKeyUp(KeyEventArgs)
This method is not relevant for this element.
Declaration
protected override void DoKeyUp(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
|
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
|
KeyboardLayoutType
value
The keyboard layout type to create a panel for. |
Returns
|
VirtualKeyboardLayoutPanel
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.
Declaration
public string GetTextFromKeyInfo(KeyInfo keyInfo)
Parameters
|
KeyInfo
keyInfo
The key information object containing text variants. |
Returns
|
System.String
The text that should be displayed or sent for the key. |
Implements
InitializeFields()
Initializes member fields to their default values during element construction.
Declaration
protected override void InitializeFields()
Overrides
OnKeyboardLayoutChanged(VirtualKeyboardLayoutChangedEventArgs)
Raises the KeyboardLayoutChanged event with the specified event arguments.
Declaration
protected virtual void OnKeyboardLayoutChanged(VirtualKeyboardLayoutChangedEventArgs e)
Parameters
|
VirtualKeyboardLayoutChangedEventArgs
e
The event arguments containing layout change information. |
OnKeyDown(KeyEventArgs)
This method is not relevant for this element.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
|
Overrides
OnKeyPress(KeyPressEventArgs)
This method is not relevant for this element.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
|
System.Windows.Forms.KeyPressEventArgs
e
|
Overrides
OnKeyPressed(Keys)
Handles key press events from the system and updates lock key states accordingly.
Declaration
public void OnKeyPressed(Keys key)
Parameters
|
System.Windows.Forms.Keys
key
The key that was pressed. |
Implements
OnKeyUp(KeyEventArgs)
This method is not relevant for this element.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
|
Overrides
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
|
VirtualKeyboardKeySendingEventArgs
e
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
|
VirtualKeyboardKeySentEventArgs
e
The event arguments containing key sent information. |
PlaySound()
Plays the configured click sound if UseClickSound is enabled.
Declaration
protected virtual void PlaySound()
RaiseKeyDown(KeyEventArgs)
This method is not relevant for this element.
Declaration
protected override void RaiseKeyDown(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
|
Overrides
RaiseKeyPress(KeyPressEventArgs)
This method is not relevant for this element.
Declaration
protected override void RaiseKeyPress(KeyPressEventArgs e)
Parameters
|
System.Windows.Forms.KeyPressEventArgs
e
|
Overrides
RaiseKeyUp(KeyEventArgs)
This method is not relevant for this element.
Declaration
protected override void RaiseKeyUp(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
|
Overrides
Send(IKey, Char)
Sends a character input to the focused application.
Declaration
public void Send(IKey sender, char symbol)
Parameters
|
IKey
sender
The key instance that initiated the send operation. |
|
System.Char
symbol
The character to send. |
Implements
Send(IKey, Int32)
Sends a key input using the specified virtual key code to the focused application.
Declaration
public void Send(IKey sender, int virtualKey)
Parameters
|
IKey
sender
The key instance that initiated the send operation. |
|
System.Int32
virtualKey
The virtual key code to send. |
Implements
Send(IKey, String)
Sends text input to the focused application.
Declaration
public void Send(IKey sender, string text)
Parameters
|
IKey
sender
The key instance that initiated the send operation. |
|
System.String
text
The text string to send. |
Implements
Send(IKey, Keys)
Sends a key input using the specified System.Windows.Forms.Keys enumeration value to the focused application.
Declaration
public void Send(IKey sender, Keys key)
Parameters
|
IKey
sender
The key instance that initiated the send operation. |
|
System.Windows.Forms.Keys
key
The System.Windows.Forms.Keys value to send. |
Implements
SendCore(IKey, KeySendContext, Nullable<Int32>, 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 = default(int? ), string text = null)
Parameters
|
IKey
sender
The key instance that initiated the send operation. |
|
KeySendContext
context
The context indicating whether to send as virtual key or text. |
|
System.Nullable<System.Int32>
virtualKey
The virtual key code when sending as virtual key. |
|
System.String
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
|
System.Globalization.CultureInfo
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
|
IKey
key
The key to update the state for. |
Events
KeyboardLayoutChanged
Occurs when the keyboard layout or culture changes, providing information about the old and new cultures.
Declaration
public event VirtualKeyboardLayoutChangedEventHandler KeyboardLayoutChanged
Event Type
|
VirtualKeyboardLayoutChangedEventHandler
|
KeyDown
This event is not relevant for this element.
Declaration
public event KeyEventHandler KeyDown
Event Type
|
System.Windows.Forms.KeyEventHandler
|
KeyPress
This event is not relevant for this element.
Declaration
public event KeyPressEventHandler KeyPress
Event Type
|
System.Windows.Forms.KeyPressEventHandler
|
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 Type
|
VirtualKeyboardKeySendingEventHandler
|
KeySent
Occurs after a key has been successfully sent to the target application.
Declaration
public event VirtualKeyboardKeySentEventHandler KeySent
Event Type
|
VirtualKeyboardKeySentEventHandler
|
KeyUp
This event is not relevant for this element.
Declaration
public event KeyEventHandler KeyUp
Event Type
|
System.Windows.Forms.KeyEventHandler
|
Explicit Interface Implementations
IKeyPressedListener.OnMouseDown(Point)
Declaration
void IKeyPressedListener.OnMouseDown(Point mousePosition)
Parameters
|
System.Drawing.Point
mousePosition
|
Implements
IKeyPressedListener.OnMouseUp(Point)
Declaration
void IKeyPressedListener.OnMouseUp(Point mousePosition)
Parameters
|
System.Drawing.Point
mousePosition
|
Implements
IKeyPressedListener.ShouldInterceptMouseEvents(Point)
Declaration
bool IKeyPressedListener.ShouldInterceptMouseEvents(Point mousePosition)
Parameters
|
System.Drawing.Point
mousePosition
|
Returns
|
System.Boolean
|