Note that there are some explanatory texts on larger screens.

plurals
  1. POTablet PC Input Panel does not cause TextInput event?
    primarykey
    data
    text
    <p>I have a custom control that consumes WPF TextInput events. This works fine when using the keyboard; however, if the hand-writing recognition of the "Tablet PC Input Panel" (comes with Windows 7) is used, no TextInput event occurs when the "Insert" button is clicked.</p> <pre><code>public partial class Window1 : Window { public Window1() { } protected override void OnTextInput(TextCompositionEventArgs e) { base.OnTextInput(e); this.Title = e.Text; } } class Text : Control { static Text() { KeyboardNavigation.IsTabStopProperty.OverrideMetadata( typeof(Text), new FrameworkPropertyMetadata(true)); KeyboardNavigation.TabNavigationProperty.OverrideMetadata( typeof(Text), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); FocusableProperty.OverrideMetadata( typeof(Text), new FrameworkPropertyMetadata(true)); } public static readonly DependencyProperty EnteredTextProperty = DependencyProperty.Register("EnteredText", typeof(string), typeof(Text), new FrameworkPropertyMetadata()); public string EnteredText { get { return (string)GetValue(EnteredTextProperty); } set { SetValue(EnteredTextProperty, value); } } protected override void OnTextInput(TextCompositionEventArgs e) { this.EnteredText = e.Text; e.Handled = true; } /// &lt;inheritdoc/&gt; protected override void OnMouseDown(MouseButtonEventArgs e) { base.OnMouseDown(e); Focus(); } } </code></pre> <p>Here's the XAML:</p> <pre><code>&lt;Window x:Class="TestProject.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300" &gt; &lt;local:Text xmlns:local="clr-namespace:TestProject"&gt; &lt;Control.Template&gt; &lt;ControlTemplate TargetType="local:Text"&gt; &lt;Border Background="Beige"&gt; &lt;Viewbox&gt; &lt;TextBlock Text="{TemplateBinding EnteredText}"/&gt; &lt;/Viewbox&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Control.Template&gt; &lt;/local:Text&gt; &lt;/Window&gt; </code></pre> <p>When the app is started, text input appears in the title bar. This works both with keyboard and handwriting recognition. Once you click within the window to give focus to the control, only the keyboard will work for input; the hand-writing recognition is ignored.</p> <p>Does anyone know what is going wrong? Why do I get the TextInput event in one case but not in the other? Is this a bug in WPF? Is there a work around?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload