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
Initializes a new instance of the RadVirtualKeyboardElement class with default settings and registers event listeners.
public RadVirtualKeyboardElement()
Properties
Gets or sets the audio stream used for key press sounds. Returns the default sound if no custom stream is set.
public Stream ClickSoundStream { get; set; }
Gets or sets the culture used for keyboard layout and key text generation.
public CultureInfo CurrentCulture { get; set; }
Gets a value indicating whether the Alt modifier key is currently in active state.
public bool IsAltActive { get; }
Gets a value indicating whether the AltGr (right Alt) modifier key is currently in active state.
public bool IsAltGrActive { get; }
Gets a value indicating whether the CapsLock key is currently active system-wide.
public static bool IsCapsLockOn { get; }
Gets a value indicating whether the Control modifier key is currently in active state.
public bool IsControlActive { get; }
Gets a value indicating whether the NumLock key is currently in active state.
public bool IsNumLockActive { get; }
Implements:
Gets a value indicating whether the NumLock key is currently active system-wide.
public static bool IsNumLockOn { get; }
Gets a value indicating whether the ScrollLock key is currently active system-wide.
public static bool IsScrollLockOn { get; }
Gets a value indicating whether the Shift modifier key is currently in active state.
public bool IsShiftActive { get; }
Implements:
Gets a value indicating whether the Windows modifier key is currently in active state.
public bool IsWindowsKeyActive { get; }
Gets the collection of objects that implement IKeyboardLayoutUpdatedListener and will be notified when keyboard layout or language changes.
public static IList<IKeyboardLayoutUpdatedListener> KeyboardLayoutUpdatedListenersList { get; }
Gets the timer that periodically checks for system language changes and notifies listeners when changes occur.
public static Timer LanguageCheckTimer { get; }
Gets or sets the keyboard layout type which determines the arrangement and availability of keys on the virtual keyboard.
public KeyboardLayoutType LayoutType { get; set; }
Gets or sets the main layout panel that hosts and arranges the keyboard layouts and key elements.
public VirtualKeyboardLayoutPanel MainLayoutPanel { get; set; }
ModifierKeys
List<int>
Gets the collection of virtual key codes for currently active modifier keys.
public List<int> ModifierKeys { get; }
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.
public static bool PreventPopupsAutoClose { get; set; }
true if the virtual keyboard should intercept system mouse events; otherwise, false.
The default value is true.
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.
Gets or sets a value indicating whether the font size should be automatically scaled when the control size changes.
public bool ScaleFontOnResize { get; set; }
Implements:
Gets or sets a value indicating whether the virtual keyboard will automatically synchronize with system language changes.
public bool SynchronizeCultureWithSystem { get; set; }
Gets the collection of objects that implement IUpdateKeysListener and will be notified when CapsLock, NumLock or ScrollLock state changes.
public static IList<IUpdateKeysListener> UpdateKeysListenersList { get; }
Gets or sets a value indicating whether a click sound should be played when keys are pressed.
public bool UseClickSound { get; set; }
Methods
Releases all managed resources used by the RadVirtualKeyboardElement and removes event listeners.
protected override void DisposeManagedResources()
Overrides:
Returns a VirtualKeyboardLayoutPanel instance with predefined keyboard layout based on the specified layout type.
protected virtual VirtualKeyboardLayoutPanel GetLayoutPanelByLayoutType(KeyboardLayoutType value)
The keyboard layout type to create a panel for.
Returns:A new VirtualKeyboardLayoutPanel instance configured for the specified layout type.
Extracts the appropriate text representation from a KeyInfo object based on current modifier key states.
Initializes member fields to their default values during element construction.
protected override void InitializeFields()
Overrides:
Raises the KeyboardLayoutChanged event with the specified event arguments.
protected virtual void OnKeyboardLayoutChanged(VirtualKeyboardLayoutChangedEventArgs e)
The event arguments containing layout change information.
Handles key press events from the system and updates lock key states accordingly.
Called when the element has been successfully loaded including all its children.
protected override void OnLoaded()
Overrides:
Raises the KeySending event with the specified event arguments.
protected virtual void OnVirtualKeySending(VirtualKeyboardKeySendingEventArgs e)
The event arguments containing key sending information.
Raises the KeySent event with the specified event arguments and plays the click sound if enabled.
protected virtual void OnVirtualKeySent(VirtualKeyboardKeySentEventArgs e)
The event arguments containing key sent information.
Plays the configured click sound if UseClickSound is enabled.
protected virtual void PlaySound()
Core implementation for sending key input with support for both virtual key codes and text.
protected virtual void SendCore(IKey sender, KeySendContext context, int? virtualKey = null, string text = null)
The key instance that initiated the send operation.
contextKeySendContextThe context indicating whether to send as virtual key or text.
virtualKeyint?The virtual key code when sending as virtual key.
textstringThe text when sending as text.
Handles keyboard layout changes from the system and updates the virtual keyboard accordingly.
public void UpdateKeyboardLayout(CultureInfo culture)
The new culture information representing the changed keyboard layout.
Implements:
Updates the text and appearance of all keys in the virtual keyboard based on the current culture and modifier key states.
public void UpdateKeys()
Implements:
Notifies all registered listeners when CapsLock, NumLock or ScrollLock state changes.
public static void UpdateKeysListeners()
Updates the visual state of modifier and lock keys based on the current keyboard state.
protected virtual void UpdateModifierKeys(IKey key)
The key to update the state for.
Events
Occurs when the keyboard layout or culture changes, providing information about the old and new cultures.
public event VirtualKeyboardLayoutChangedEventHandler KeyboardLayoutChanged
Occurs before a key is sent to the target application, allowing cancellation or modification of the key operation.
public event VirtualKeyboardKeySendingEventHandler KeySending
Occurs after a key has been successfully sent to the target application.
public event VirtualKeyboardKeySentEventHandler KeySent