A developer’s view

WPF TextBox differences

· Read in about 2 min · (419 Words)
WPF TextBox

WPF control share no code with the old-style Win32 controls that are used in traditional Windows applications. The WinForms controls wrap the native Win32 controls and extend them in some areas. The WPF library complete rewrites these controls in native .NET code, so some differences may occur. In this post I will describe two small differences that might be annoying.

Using US international keyboard on Windows XP

Using a keyboard setting that allows composing letters with diacritics have some issues on Windows XP. If you set your keyboard to US international and you want to type a (double) quotation mark, then you are used to press ” and then hit the space bar. This doesn’t work correctly on Windows XP, because it will show a space instead of the quotation mark. It will only show the quotation mark when you press a letter. This behaviour is only on Windows XP with this keyboard setting, but because a lot of European end-users will use this setting it can become quite annoying. Typing quotation marks is engraved in one’s brain and it’s hard to get used to a different behaviour. I think this behaviour is wrong and filed an issue with Microsoft that can be tracked here.

Microsoft confirms that this is a bug and a hotfix is available (hotfix ID 376849), but you need to have QFE privileges to obtain the hotfix. Unfortunately, MS Netherlands doesn’t know anything about the QFE :-(. The issue is resolved in .NET Framework 4.0.

No initial selection

When you focus the textbox in Win32 or WinForms, then the text is automatically selected. WPF doesn’t select the text by default.

Default selection is different from old-style textbox

If you type the string “[email protected]” (without the quotation marks) and you double click on the word “Ramon”, then an old-style textbox will select the entire email address, but WPF textboxes will only select the word “Ramon”. Due to this different kind of finding “spaces”, other functionality that depends on it works different too. If you use CTRL-LEFT or CTRL-RIGHT, then it also is different. It’s different behaviour and I consider it a bug, because people are so used to the old-style functionality that this change might be difficult for end-users to get used to. A bug has been filed, but MS doesn’t consider this to be a bug.

Visual Studio 2010 is expected this year and I am looking forward how the changes reflect the Visual Studio IDE or if the IDE team uses its own controls.

Comments