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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.