-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2838 from telerik/new-kb-kb-pivotgrid-enable-keyb…
…oard-input-in-winforms-c1c226654b7c4a26b6c5f11cfd75c999 Added new kb article kb-pivotgrid-enable-keyboard-input-in-winforms
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
knowledge-base/kb-pivotgrid-enable-keyboard-input-in-winforms.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: Enable Keyboard Input in WPF Window Opened from WinForms Application | ||
description: This article explains how to enable keyboard input in the Label Filter dialog of RadPivotGrid opened from a WinForms application. | ||
type: how-to | ||
page_title: Enable Keyboard Input in the RadPivotFieldList Label Filter Window Used in WinForms Application | ||
slug: kb-pivotgrid-enable-keyboard-input-in-winforms | ||
tags: wpf, winforms, RadPivotGrid, keyboard input | ||
res_type: kb | ||
--- | ||
## Environment | ||
|
||
| Property | Value | | ||
| --- | --- | | ||
| Product | RadPivotGrid for WPF | | ||
| Version | 2023.1.117 | | ||
|
||
## Description | ||
|
||
The Label Filter dialog show through the RadPivotFieldList (part of RadPivotGrid) for WPF doesn't allow to input any values in its TextBox controls when the RadPivotFieldList for WPF is hosted in a WinForms application. | ||
|
||
## Solution | ||
|
||
To resolve this, you need to enable keyboard input in WPF dialog opened in the WinForms application. This is done by calling the `ElementHost.EnableModelessKeyboardInterop` static method with the opened WPF Window instance. | ||
|
||
#### __[C#]__ | ||
{{region kb-pivotgrid-enable-keyboard-input-in-winforms-0}} | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
this.radPivotFieldList.AddHandler(RoutedDialogEvents.RequestDialog, new EventHandler<DialogHostingRequestEventArgs>(this.OnDialogHostRequested), true); | ||
} | ||
|
||
private void OnDialogHostRequested(object sender, DialogHostingRequestEventArgs e) | ||
{ | ||
var dialogContent = (FrameworkElement)e.DialogInfo.Content; | ||
var window = dialogContent.ParentOfType<Window>(); | ||
if (window != null) | ||
{ | ||
ElementHost.EnableModelessKeyboardInterop(window); | ||
} | ||
} | ||
{{endregion}} |