Skip to content

Commit

Permalink
Merge pull request #2838 from telerik/new-kb-kb-pivotgrid-enable-keyb…
Browse files Browse the repository at this point in the history
…oard-input-in-winforms-c1c226654b7c4a26b6c5f11cfd75c999

Added new kb article kb-pivotgrid-enable-keyboard-input-in-winforms
  • Loading branch information
StenlyGrigorov authored Mar 15, 2024
2 parents 4b935fb + 5f9a2cb commit d21bb77
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions knowledge-base/kb-pivotgrid-enable-keyboard-input-in-winforms.md
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}}

0 comments on commit d21bb77

Please sign in to comment.