WPF Sürüm 4'te Yenilikler

This topic contains information about new and enhanced features in Windows Presentation Foundation (WPF) version 4.

This topic contains the following sections:

  • New Controls

  • Visual State Manager

  • Touch and Manipulation

  • Graphics and Animations

  • Text

  • Binding

  • XAML Browser Applications

  • WPF and Windows

  • WPF and Silverlight Designer

New Controls

Three new controls have been added to WPF to make it easier to create business applications. These controls are almost 100 percent compatible with the Silverlight versions. This enables developers to reuse code and quickly create client and Web versions.

Visual State Manager

WPF provides better support for changing visual states in a ControlTemplate. The VisualStateManager class and supporting classes have been added so that tools such as Microsoft Expression Blend can be used to define a control's appearance according to its visual state. For example, you can define the appearance of a Button control when it is in the Pressed state. For more information about creating a ControlTemplate that uses the VisualStateManager for an existing control, see ControlTemplate Oluşturarak Mevcut Denetimin Görünümünü Özelleştirme. For information about creating a new control that uses the VisualStateManager, see Özelleştirilebilir Görünümü olan Denetim Oluşturma.

NotNot

Elements can take advantage of the VisualStateManager outside of a ControlTemplate by using the GoToElementState method.

Touch and Manipulation

Elements in WPF now accept touch input. The UIElement, and UIElement3D, and ContentElement classes expose events that occur when a user touches an element on a touch-enabled screen. In addition to the touch events, the UIElement supports manipulation. A manipulation is interpreted to scale, rotate, or translate the UIElement. For example, a photo viewing application might allow users to move, zoom, resize, and rotate a photo by touching the computer screen over the photo. For more information about touch, see İzlenecek Yol: İlk Dokunmatik Uygulamanızı Oluşturma and Giriş Genel Bakış.

Graphics and Animations

Several changes have been made related to graphics and animations.

  • Layout Rounding

    When an object edge falls in the middle of a pixel device, the DPI-independent graphics system can create rendering artifacts, such as blurry or semi-transparent edges. Previous versions of WPF included pixel snapping to help handle this case. Silverlight 2 introduced layout rounding, which is another way to move elements so that edges fall on whole pixel boundaries. WPF now supports layout rounding with the UseLayoutRounding attached property on FrameworkElement.

  • Cached Composition

    By using the new BitmapCache and BitmapCacheBrush classes, you can cache a complex part of the visual tree as a bitmap and greatly improve rendering time. The bitmap remains responsive to user input, such as mouse clicks, and you can paint it onto other elements just like any brush.

  • Pixel Shader 3 Support

    WPF 4 builds on top of the ShaderEffect support introduced in WPF 3.5 SP1 by allowing applications to now write effects by using Pixel Shader (PS) version 3.0. The PS 3.0 shader model is more sophisticated than PS 2.0, which allows for even more effects on supported hardware.

  • Easing Functions

    You can enhance animations with easing functions, which give you additional control over the behavior of animations. For example, you can apply an ElasticEase to an animation to give the animation a springy behavior. For more information, see the easing types in the System.Windows.Media.Animation namespace.

Text

Several changes have been made related to text.

  • New Text Rendering Stack

    The WPF text rendering stack has been completely replaced. This change brings improvements to text rendering configurability, clarity, and support for international languages. The new text stack now supports explicitly selecting aliased, grayscale, or ClearType rendering modes. The text stack now supports display-optimized character layout, to produce text with sharpness comparable to Win32/GDI text. The new text stack allows optimizing text hinting and snapping for either animated or static text. The new text stack also supports fonts with embedded bitmaps to be substituted for smaller font sizes, allowing many East Asian fonts to render with sharpness comparable to Win32/GDI text.

  • Selection and Caret Customization

    You can now specify the brush that paints the selection and caret for input and reading controls, such as TextBox RichTextBox, and FlowDocumentReader. There are two new properties on TextBoxBase:

    • SelectionBrush allows you to create a brush for highlighting selected text.

    • CaretBrush allows you to change the brush that paints the cursor.

Binding

Various changes and enhancements have been made related to binding.

XAML Browser Applications

Two features have been added to XAML browser applications (XBAPs).

  • HTML-XBAP Script Interop

    You can now communicate with the Web page containing the XBAP when the application is hosted in a HTML frame. The XBAP can get deep access to the HTML DOM and can handle DOM events. For more information see BrowserInteropHelper.HostScript.

  • Full-Trust XBAP Deployment

    If your XBAP requires full trust, the user will now automatically receive the standard ClickOnce elevation prompt when they install the application from the intranet or one of their browser's trusted sites.

For more information on both these features, see WPF XAML Tarayıcı Uygulamalarına Genel Bakış.

WPF and Windows

The Windows 7 taskbar provides enhanced functionality that enables you to use the taskbar button to communicate status to a user and expose common tasks. New types in the System.Windows.Shell namespace provide managed wrappers for functionality in the Windows 7 taskbar and manages the data passed to the Windows shell. For example, the JumpList type allows you to work with Jump Lists and the TaskbarItemInfo type allows you to work with taskbar thumbnails.

WPF dialog boxes on Windows 7 and Windows Vista now support the look and feel of the Windows 7 and Windows Vista style, which includes custom places. For more information, see the FileDialogCustomPlace class.

WPF and Silverlight Designer

In Visual Studio 2010, various designer improvements have been made to help create WPF or Silverlight applications.

  • Improved Support for Silverlight

    In Visual Studio 2008, you could install the Silverlight Tools to create Silverlight applications in Visual Studio. However, the designer support for Silverlight projects was limited. In Visual Studio 2010, the designer support for Silverlight and WPF projects are now the same. For example, in Silverlight projects you can now select and position items with the mouse on the design surface.

  • Support for Multiple Platform Versions

    In Visual Studio 2008, control design times were able to target only the latest WPF platform version. In Visual Studio 2010, this support is extended across multiple platforms, including design-time support for WPF 3.5, WPF 4, Silverlight 3, Silverlight 4, and future platform releases. As the same extensibility API exists for all these platforms, control design-time authors can easily write one experience and share it across the control runtimes for each platform.

  • Visual Databinding

    The new data binding builder enables visual construction and editing of bindings without typing XAML.

  • Auto Layout

    Layout improvements include a more intuitive Grid designer and better support for automatically sizing user controls.

  • Improved Property Editing

    The Properties window now enables visually creating and editing Brush resources.

For more information, see WPF Tasarımcısı.

Ayrıca bkz.

Kavramlar

What's New in the .NET Framework 4