WrapPanel : Child controls are positioned in left-to-right order and wrapped to the next line when there isn't enough space. The following example uses a DockPanel to lay out several TextBox controls:. The DockPanel allows the child TextBox controls to tell it how to arrange them. To do this, the DockPanel implements a Dock attached property that is exposed to the child controls to allow each of them to specify a dock style.
A property that's implemented by a parent control for use by child controls is a WPF construct called an attached property. Most applications are created to provide users with the means to view and edit data. For WPF applications, the work of storing and accessing data is already provided for by many different. After the data is accessed and loaded into an application's managed objects, the hard work for WPF applications begins.
Essentially, this involves two things:. Copying the data from the managed objects into controls, where the data can be displayed and edited. To simplify application development, WPF provides a powerful data binding engine to automatically handle these steps.
The core unit of the data binding engine is the Binding class, whose job is to bind a control the binding target to a data object the binding source.
This relationship is illustrated by the following figure:. This assumes there's a data object set to the DataContext property of the Window with a Name property. The WPF data binding engine provides more than just binding, it provides validation, sorting, filtering, and grouping.
Furthermore, data binding supports the use of data templates to create custom user interface for bound data. For more information, see Data binding overview. WPF provides an extensive and flexible set of graphics features that have the following benefits:. Resolution-independent and device-independent graphics. Each device-independent pixel automatically scales to match the dots-per-inch dpi setting of the system it renders on. Improved precision.
The WPF coordinate system is measured with double-precision floating-point numbers rather than single-precision. Transformations and opacity values are also expressed as double-precision.
WPF also supports a wide color gamut scRGB and provides integrated support for managing inputs from different color spaces. Advanced graphics and animation support.
WPF simplifies graphics programming by managing animation scenes for you; there's no need to worry about scene processing, rendering loops, and bilinear interpolation. Additionally, WPF provides hit-testing support and full alpha-compositing support. Hardware acceleration. WPF provides a library of common vector-drawn 2D shapes, such as the rectangles and ellipses.
The shapes aren't just for display; shapes implement many of the features that you expect from controls, including keyboard and mouse input. The 2D shapes provided by WPF cover the standard set of basic shapes. However, you may need to create custom shapes to help the design of a customized user interface. WPF provides geometries to create a custom shape that can be drawn directly, used as a brush, or used to clip other shapes and controls.
For more information, see Geometry overview. A subset of WPF 2D capabilities includes visual effects, such as gradients, bitmaps, drawings, painting with videos, rotation, scaling, and skewing. These effects are all achieved with brushes. The following figure shows some examples:. For more information, see WPF brushes overview. WPF also includes 3D rendering capabilities that integrate with 2D graphics to allow the creation of more exciting and interesting user interfaces.
For example, the following figure shows 2D images rendered onto 3D shapes:. For more information, see 3D graphics overview. WPF animation support lets you make controls grow, shake, spin, and fade, to create interesting page transitions, and more.
You can animate most WPF classes, even custom classes. The following figure shows a simple animation in action:. For more information, see Animation overview.
As a demonstration of text integration with graphics, the following figure shows the application of text decorations:. For more information, see Typography in Windows Presentation Foundation. Often, though, the basics aren't enough for creating and managing a truly distinct and visually stunning user experience. The standard WPF controls might not integrate with the desired appearance of your application.
Data might not be displayed in the most effective way. Your application's overall user experience may not be suited to the default look and feel of Windows themes.
The main purpose of most of the WPF controls is to display content. In WPF, the type and number of items that can constitute the content of a control is referred to as the control's content model. Some controls can contain a single item and type of content. For example, the content of a TextBox is a string value that is assigned to the Text property. Other controls, however, can contain multiple items of different types of content; the content of a Button , specified by the Content property, can contain various items including layout controls, text, images, and shapes.
For more information on the kinds of content that is supported by various controls, see WPF content model. Although the main purpose of XAML markup is to implement an application's appearance, you can also use XAML to implement some aspects of an application's behavior. One example is the use of triggers to change an application's appearance based on user interactions. For more information, see Styles and templates. Streamline your development experience with first class debugging features like IntelliTrace, Code execution control and inspection, UI debugging tools for XAML, and a great experience for understanding and resolving Exceptions.
Identify bottlenecks and improve your performance with a scenario-centric view of resource usage in your application. Adopt testing practices such as manual, automated, exploratory and load testing with Visual Studio and Team Foundation Server. Engage with a passionate developer community and quickly adopt established and emerging patterns and practices with a large number of third-party and Open Source libraries.
The community is further bolstered by the presence of reputed control and tool vendors building extensive sets of components and controls for the platform. Visual Studio Community Visual Studio Professional Visual Studio Enterprise This device is not currently supported for these products. To continue downloading, click here. Professional Enterprise NET Framework. Power, security, and flexibility. We're sorry! We don't recognize your username or password.
Please try again. The work is protected by local and international copyright laws and is provided solely for the use of instructors in teaching their courses and assessing student learning. You have successfully signed out and will be required to sign back in should you need to download more resources. Out of print. If You're an Educator Preview this title online Additional order info. Overview Contents Order Authors Overview. Chris does a great job of not only explaining how to use the new features and capabilities of WPF with associated code and XAML based syntax , but also explains why things work the way they do.
As one of the architects of WPF, Chris gives great insight into the plumbing and design principles of WPF, as well as the mechanics of writing code using it.
This is truly essential if you plan to be a serious WPF developer. I can only speak for myself, but when faced with a new technology I like to have an understanding of how it relates to and works in relation to the technology it is supplanting.
0コメント