Ian is an independent consultant, developer, speaker, and author. He has written books on Windows Presentation Foundation, Windows Forms, and Visual Studio. He lives in London but can often be found on various developer mailing lists and newsgroups, where a popular sport is to see who can get him to write the longest email in reply to the shortest possible question.
DataGrid Part I In WPF Version 4, the DataGrid control that was previously part of the WPF toolkit became a built-in feature of the. NET framework. It provides a convenient and quick way to show collections of data in a table-like form. DataGrids aren't exactly the most user-friendly way to present information, but they're very popular as a quick-fix solution for getting the information inside an application onto the screen and letting the user edit that information.
DataGrid Part II In the first module on the DataGrid, we focused on how to configure the columns shown in the grid. In this second module, we'll look at some other features it offers.
Visual State Manager When customizing a control with a template, it's common to want to make the control's appearance reflect its state. For example, we want buttons to look different when the mouse moves over them or when they're pressed. And it's not always superficial interactive state either. Some controls have important information to reflect. Checkboxes need to show whether they're currently checked, for example. In WPF we usually handle this with triggers; however, in version 4 WPF acquired an alternative mechanism called the Visual State Manager. It didn't need this, strictly speaking, because triggers are ultimately more powerful; however, the Visual State Manager provides compatibility with Silverlight. For various reasons Silverlight does not support triggers, but it still needs controls to reflect their state visually, and so Silverlight introduced the Visual State Manager. It's slightly less flexible than triggers, although its simplicity can sometimes make it easier to work with. So the Visual State Manager does not replace triggers. As WPF developers, we can use either mechanism. However, if you're using or developing controls that can be compiled for both Silverlight and WPF, the Visual State Manager lets you share template definitions across both platforms, and in some scenarios the simplicity may make the Visual State Manager a better choice even in applications that are targeting only WPF.
Text and ClearType In the past, WPF has been criticized for making text look slightly blurry, but in version 4 text rendering became more flexible offering developers more choice between the various compromises involved in rendering text on screen. To understand exactly what's changed in WPF 4, it's necessary to understand why text rendering presents a problem in the first place.
Miscellaneous WPF 4 Features In this, the final module of this course on what changed in WPF 4, we look at a set of miscellaneous features, none of which is big enough to warrant a separate talk, but all of which are worth knowing about. There are various features that improve WPF's graphical performance. The layout engine has a new rounding feature copied from Silverlight that improve the clarity of your visuals in certain scenarios. The animation system now has the same easing functions of Silverlight making it simpler to produce certain kinds of natural looking motion. WPF 4 introduced support for multitouch input devices. It also made it possible to customize the dictionaries used for spellchecking in the TextBox and Rich TextBox. And finally, the XAML parsing infrastructure was comprehensively revamped to provide better support for XAML- based tools, such as Expression Blend and the XAML Designer in Visual Studio.