WPF Where and we
WPF applications have a great deal of power, at which this chapter can only hint.
The base services of the application aren’t too surprising, but the support for pagebased
navigation and browser hosting certainly adds a new capability for Windows
applications, further enhanced with .NET 2.0 ClickOnce support.
Building your application is a matter of grouping controls in containers—either single
content containers, like windows or buttons, or multiple content containers that
provide layout capabilities, like the canvas and the grid.
When bringing your controls together, you’ll want to populate them with data that’s
synchronized with the in-memory home of the data, which is what data binding is
for, and keep them pretty, which is what styles are for. If you want to declare data or
styles in your XAML, you can do so using resources, which are just arbitrarily named
objects that aren’t used to render the WPF UI directly.
If no amount of data or style property settings makes you satisfied with the look of
your control, you can replace it completely with control templates, which can comprise
other controls or graphics primitives. In addition, you can apply graphics
operations, like rotating, scaling, or animation, to 2D or 3D graphics primitives or
controls in WPF’s integrated way. These elements can further be gathered into documents
for viewing or printing.
More recently, the Windows Presentation Foundation (WPF) happened. Initially it
felt like another way to create my windows, menus, dialogs, and child controls.
However, WPF shares a much deeper love for content than has yet been provided by
any other Windows programming framework.
To support content at the lowest levels, WPF merges controls, text, and graphics
into one programming model; all three are placed into the same element tree in the
same way. And although these primitives are built on top of DirectX to leverage the
3D hardware acceleration that is dormant when you’re not running the latest twitch
game, they’re also built into .NET, providing the same productivity boost to WPF
programmers that Windows Forms programmers enjoy.
To help you arrange the content, whether in fixed or flow layout, WPF provides container
elements that implement various layout algorithms in a way that is completely
independent of the content they’re holding.
To help you visualize the content, WPF provides data binding, control templates,
and animation. Data binding produces and synchronizes visual elements on the fly
based on your content. Control templates allow you to replace the complete look of
a control while maintaining its behavior. Animation brings your user interface control
to life, giving your users immediate feedback as they interact with it. These features
give you the power to produce data visualizations so far beyond the capabilities
of the data grid, the pinnacle most applications aspire to, that even Edward Tufte
would be proud.
Combine these features with ClickOnce for the deployment and update of your
WPF applications, both as standalone clients and as blended with your web site
inside the browser, and you’ve got the foundation of the next generation of Windows
applications.
No comments:
Post a Comment