WPF Panels and the Aqua Workspace Panel

[Infragistics] Curtis Taylor / Friday, June 5, 2009

One of the powerful things about Windows Presentation Foundation and Silverlight is the hierarchical presentation of user interface elements within a dynamic Panel layout. Panels are a part of WPF you don’t hear a lot about, yet are the key aspect of laying out an interface. Panels are used to automate the arrangement and even sizing of interface elements within a View. With a little design, Panels can be used to ensure localized text always fits. Panels can be used to size or anchor elements within resizable containers or windows. Panels can also be used to dynamically implement an algorithm for specific positioning and sizing of children elements.

WPF and Silverlight come with a few useful Panels. The Grid is the most versatile as it can be used to support auto-sizing of elements, a specific layout within a grid of rows and columns, and a percentage ratio for sizing. StackPanel is also useful in that it simply places elements sequentially in a horizontal or vertical stack. The days of only positioning elements using hard-coded x, y coordinates are over. However, WPF and Silverlight do still provide that ability with the Canvas Panel. Both technologies also provide a DockPanel for docking elements to sides of the Panel and a WrapPanel which adds wrapping to the StackPanel. Silverlight adds these last two Panels with its Toolbox controls library. Additionally, WPF provides a simplified Grid Panel called the UniformGrid.

The Panel class is a public class which any programmer can derive from to implement a custom algorithm. Infragistics takes advantage of this ability by creating various custom interfaces for customers, for the community and for internal purposes. The Panel approach is one of many ways to deliver a custom interface. As a result, WPF and Silverlight empower developers and designers to more easily create their own interfaces. And, it can often be more cost effective to utilize third party offerings of custom controls. Infragistics produces complex and highly useful interfaces to help users concentrate on other aspects of development. The Aqua Workspace Panel is an example of this. The Workspace Panel (also called Tiles Panel) will arrange elements according to a specified Grid layout. It will allow the user to size and swap items within the view. It will also present an alternate view where one item can be maximized to fill most of the panel and the rest minimized. When the container panel is resized (by resizing the window), all the elements will size accordingly. This is because the Panel abstraction provides the means for communicating and negotiating with each element to resize and re-position. The same is true for Panel drag and drop. When the user clicks and drags an element, the Panel ensures the items move within the Panel when the user “drags” and is re-positioned when the user “drops” the item into a new space in the Panel.

Panels are just one of the many ways user interfaces can be customized within WPF and Silverlight. This technology also provides custom collection elements derived from ItemsControl which are used to create List Boxes, Menus, Tab Controls and Combo Boxes. Custom Control elements with Control Templates also provide the ability to create user-customizable elements which follow any paradigm you can imagine. Aqua capitalizes on the powerful features of this technology to showcase its immense potential. It is our intention, with our partnership with Microsoft, to empower our collective users, to generate enthusiasm for this technology, and to seed our community with creative, innovative and enjoyable interactive presentations for the Windows software world.