INTRODUCING WPF DESIGNER

Windows Forms controls allow you to build powerful desktop applications. WPF (Windows Presentation Foundation) is a new set of controls that you can also use to build desktop applications. While WPF and Windows Forms controls provide many similar features, the WPF controls are more closely tied to high performance graphics libraries so they can provide many sophisticated graphical features that are missing from Windows Forms controls. For example, WPF controls can draw themselves at any scale without losing resolution, can display gradient backgrounds, and can contain other controls in a more flexible and consistent way than Windows Forms controls can. For a specific example of this last feature, a Windows Forms Button control can hold only text. A WPF Button control can hold other controls such as a Grid that contains several Images and TextBlocks to make a much richer experience.

In addition to giving WPF new features, Microsoft is positioning it, or more precisely the Silverlight subset of WPF, for use in building applications on its future platforms. You can build applications in Silverlight for the Windows 8 operating system, the Windows Phone operating system, or web applications. Windows Forms programs still have an important role on desktop systems but Microsoft seems determined to make WPF and Silverlight be the development tools of the future. You can still build Windows Forms applications and run them on the Windows 8 desktop, but you need to use WPF to build programs that can run within the Windows 8 Metro interface.

The WPF (Windows Presentation Foundation) Designer allows you to build WPF windows (including those used by Metro-style applications) interactively much as the Windows Forms Designer lets you build Windows Forms. It provides a WYSIWYG (what you see is what you get) surface where you can add controls to a window. If you select one or more controls on the designer’s surface, the Properties window displays the objects’ properties and lets you edit many of them.

In addition to the WYSIWYG design surface, the designer provides a XAML (Extensible Application Markup Language) code editor. Here you can view and edit the XAML code that defines the user interface. This lets you edit properties and arrange controls in ways that are impossible using the WYSIWYG designer.


NOTE
XAML is pronounced “zammel.”

This chapter provides an introduction to the WPF Designer. It explains how to add controls to a window, move and size controls, set control properties, and add code to respond to control events.


FOR MORE INFORMATION
Windows Presentation Foundation is quite large and complex, requiring you to learn about a whole new set of controls, objects, properties, animations, and other items. It even uses a whole new system for properties and events that isn’t used by Windows Forms.
The chapters in this book cover WPF in enough detail to get you started and let you build an effective application, but there’s much more to WPF. For more details, see my book WPF Programmer’s Reference: Windows Presentation Foundation with C# 2010 and .NET 4.0 (Stephens, Wrox, 2009). Some of the code examples use C# but most of the code uses XAML code, which is described by the book, so they’re applicable to Visual Basic as well. You can learn more and download the book’s example code in C# and Visual Basic versions on the book’s web page at http://www.vb-helper.com/wpf.htm.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.185.155