ValuePattern Insert Text Sample

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This sample demonstrates how to use both Microsoft UI Automation and unmanaged methods to input text into standard Win32 text controls. The target text controls are a single-line text box, a multi-line text box and a rich text box.

Since the TextPattern control pattern does not support the setting of text values in a control, the Microsoft UI Automation sample code shows how to use either the ValuePattern control pattern or standard keyboard input to simulate text input depending on the target control type.

The sample defines two applications, a target and a client that operates against the target application.

Note Note

The target application, InsertTextTarget.exe, should be automatically copied to the InsertText client folder when you build the sample and is started manually from the client. You may have to manually copy this file to the bin/debug folder of the client application if you receive an error stating that the file cannot be found.

This sample demonstrates a specific feature of the Windows Presentation Foundation (WPF) and, consequently, does not follow application development best practices. For comprehensive coverage of Windows Presentation Foundation (WPF) and Microsoft .NET Framework application development best practices, refer to the following as appropriate:

Accessibility - Accessibility Best Practices

Security - Windows Presentation Foundation Security

Localization - WPF Globalization and Localization Overview

  • Install the Windows Software Development Kit (SDK) and open its build environment command window. On the Start menu, point to All Programs, Microsoft Windows SDK, and then click CMD Shell.

  • Download the sample, usually from the software development kit (SDK) documentation, to your hard disk drive.

  • To build the sample from the build environment command window, go to the source directory of the sample. At the command prompt, type MSBUILD.

  • To build the sample in Microsoft Visual Studio, load the sample solution or project file and then press CTRL+SHIFT+B.

  • To run the compiled sample from the build environment command window, execute the .exe file in the Bin\Debug or Bin\Release folder contained under the sample source code folder.

  • To run the compiled sample with debugging in Visual Studio, press F5.

Controls that support the TextPattern control pattern do not support the ValuePattern control pattern. Since TextPattern does not support text input, it must be simulated using one of the methods demonstrated in this sample.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft