LIFE

clark94.egloos.com

포토로그




.NET Framework 4 - Windows Presentation Foundation WPF

.NET 차세대 버전인 4에 포함된 WPF 에 대해서 검색하다가 찾은
온라인 MSDN에서 등록된 .NET Framework 4 beta 2 에서 추출한 내용이다.

http://msdn.microsoft.com/en-us/library/bb613588(VS.100).aspx#new_controls

What's New in WPF Version 4

New Controls

WFP 에 비즈니스 어플리케이션을 쉽게 개발할 수 있는 새로운 3개의 컨트롤을 추가했다.
이 컨트롤들은 Silverlight 와 100% 호환 가능하다. 이로 인해서 개발자들이 코드를 재사용 가능할 뿐만 아니라 클라이언트 및 웹 버전의 어플을 빠르게 만들 수 있다.

DataGrid
Calendar
DatePicker

  Visual State Manager

WPF 는 ControlTemplate 안에 Visual State 들의 전환을 위한 더 나은 Support 을 제공한다. VisualStateManager 클래스와 이를 support 하는 클래스들이 추가되었고 이로 인해 MS Expression Blend 에서 컨트롤의 Visual State 에 따라서 외모를 정의할 수 있게 되었다. 예를 들어, Button 컨트롤이 Pressed State 에 있을 때 외모를 정의할 수 있게 되었다.

For more information about creating a ControlTemplate that uses the VisualStateManager for an existing control, see Customizing the Appearance of an Existing Control by Creating a ControlTemplate. For information about creating a new control that uses the VisualStateManager, see Creating a Control That Has a Customizable Appearance.

NoteNote

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. The following events are defined on UIElement and respond to touch input. Note that these events are also defined on UIElement3D and ContentElement.

PreviewTouchDown

TouchDown

PreviewTouchMove

TouchMove

PreviewTouchUp

TouchUp

GotTouchCapture

LostTouchCapture

TouchEnter

TouchLeave

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. The following events have been added to UIElement:

ManipulationStarted

ManipulationDelta

ManipulationInertiaStarting

ManipulationCompleted

ManipulationBoundaryFeedback

To enable manipulation, set the IsManipulationEnabled to true. For more information about touch, see Walkthrough: Creating Your First Touch Application.

  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.

  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

  Binding

Various changes and enhancements have been made related to binding.

Bind to commands on InputBinding

You can bind the Command property of an InputBinding class to an instance that is defined in code. The following properties are dependency properties, so that they can be targets of bindings:

InputBinding..::.Command

InputBinding..::.CommandParameter

InputBinding..::.CommandTarget

KeyBinding..::.Key

KeyBinding..::.Modifiers

MouseBinding..::.MouseAction

The InputBinding, MouseBinding, and KeyBinding classes receive data context from the owning FrameworkElement.

Bind to Dynamic Objects

WPF supports data binding to objects that implement IDynamicMetaObjectProvider. For example, if you create a dynamic object that inherits from DynamicObject in code, you can use markup extension to bind to the object in XAML.

Bindable Text Run

Run..::.Text is now a dependency property. The main advantage is that it now supports one-way bindings. It also supports other features of dependency properties, such as styling and templating.

  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.

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 Browser Applications Overview.

  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, 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 Designer.