Windows Presentation Foundation New Features

New features in WPF 4.0 are as following

More controls.

The family of WPF elements keeps growing. It now includes a professional DataGrid, a standard DatePicker and Calendar,and a native WebBrowser for HTML viewing and web surfing. A
separate download also adds the useful Ribbon control, which can give any application a slick, modern look.

2-D drawing improvements.

Now the visual appearance of any element can be radically altered with PhotoShop-style effects through pixel shaders (using up to version 3 of the pixel-shader standard). Developers who want to manipulate individual pixels by hand can also generate and modify images with the WriteableBitmap class.

Animation easing.

These functions allow you to create more lifelike animations

that bounce, accelerate, and oscillate naturally.

Visual state manager.

First introduced in Silverlight, the visual state manager

gives you an easier way to reskin controls without needing to

understand the intricate details of their inner workings.

Windows 7.

Microsoft’s newest operating system adds a slew of new features. WPF

includes native support for the revamped taskbar, allowing you to use jump lists,

icon overlays, progress notifications, and thumbnail toolbars.

And if you have the right hardware, you can use WPF’s

support for Windows 7 multitouch, which is the ability to gesture on a

touchscreen to manipulate visual objects.

Better rendering.

WPF continues to improve display quality and deal with the

idiosyncrasies and scaling artifacts that can occur because of its resolution

independent drawing model. In WPF 4, you can use layout rounding to make sure

layout containers line up with real pixel positions, guaranteeing a clear display.

You can also do the same for rendered text, making sure it stays

sharp even at vanishingly small sizes.

Bitmap caching.

In the right scenario, you can spare the CPU’s workload by

caching complex vector art in video card memory. This technique is particularly

handy when using animation,

XAML 2009.

WPF introduces a new version of the XAML markup standard that’s

used to declare the user interface in a window or page. It introduces a number of

small refinements, but you probably won’t use them just yet, because the standard

isn’t built into the WPF XAML compiler.

Your first WPF Drawing Application

In this lab, you will build a WPF application that allows you to draw geometries.

1. Start Microsoft Visual Studio 2008 from Start | All Programs | Microsoft Visual Studio 2008.

2. Create a new WPF project. In Visual Studio select File | New | Project. In the New Project Dialog select Visual C# | Windows in the tree view on the left, and select WPF Application (make sure that .NET Framework 3.5 is selected in the drop-down list at the top right of the dialog box).


3. In the XAML editor, change the Title property of the Window element to WPF Viewer.

4. Add an Ink Canvas to the Window and name it DrawingPad. To do this, add the following code (shown in bold) into the Grid element.

<Grid >

<Border BorderBrush=”Gray” BorderThickness=”1″ >

<InkCanvas Name=”DrawingPad” />



5. Add an event handler for the StrokeCollected event by writing code in the XAML editor (this should generate the event handler method as well). At this point, your XAML code should look like this.


<Window x:Class=” WPFViewer.Window1″



Title=”WPF  Viewer” Height=”300″ Width=”300″>

<Grid >

<Border BorderBrush=”Gray” BorderThickness=”1″ >

<InkCanvas Name=”DrawingPad” StrokeCollected=”DrawingPad_StrokeCollected” />





6. Press F5 to run the application and draw some shapes on the Ink Canvas.


7. Close the application.