Extending an Existing Control

Most of the time when you build a custom element, you'll derive from one of the base classes listed in Table 24-1, such as FrameworkElement, Control, ContentControl, or Panel. In some cases, however, you might be able to tweak an existing control so that it does what you want.

One example is the basic WPF TextBox, which can be enhanced it countless ways. In this section, you'll learn how to create a text box that approximates the MaskedTextBox from the Windows Forms world, which has no WPF equivalent.

Understanding Masked Edit Controls

A masked text box is a text box that automatically formats input as it's entered. For example, if you type 1234567890 into a masked edit control that uses a U.S. telephone number ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.