Microsoft Cloud Authors: David H Deans, Yeshim Deniz, Janakiram MSV, Andreas Grabner, Stackify Blog

Related Topics: Microsoft Cloud

Microsoft Cloud: Article

Dare to Use the Current Capabilities of Windows Presentation Foundation

And get 3D layout effects

But What Is a Panel?
Before thinking in a 3D panel it's important to review the main issues solved by the bi-dimensional panels.

If we only have a Canvas to arrange controls in the bi-dimensional space, we will need to calculate and recalculate formulas using the Left and Top properties and the size of the controls. To avoid the repetition of some recalculation patterns, WPF includes some specialized panels for the bi-dimensional world: StackPanel, Grid, etc. A common goal of all these panels is the ability to position their contained elements in a bi-dimensional area.

In addition to the above positioning functionality, according to its kind of distribution logic the panels should decide the final size to visualize each element contained inside of them.

Arrange and Measure
The type Panel is the main class in the WPF bi-dimensional layout system. Panel and its descendant types solve the positioning and resizing problems using the Arrange and Measure methods of each contained UIElement. Measure finds the desired size requested by each contained element and Arrange is called to place and resize them according to the desired size obtained from the property DesiredSize (which is calculated by each call to Measure).

Unfortunately till now UIElement3D didn't have analogous methods for the 3D world as can be seen in the note in Figure 4.

Unhappily it seems that the 3D world won't have these essential methods then. However, the good news is that at least there is a feature (Transformations) that could help to mitigate the problem of positioning 3D elements without recalculating their placements.

Tri-Dimensional Transformations
As in the bi-dimensional space there are linear-transformations for the tri-dimensional world. These transformations can be applied to any element of type Visual3D or Model3D, and to the Camera. The 3D elements can be rotated, scaled, and translated throughout the RotateTransform3D, ScaleTransform3D, and TranslateTransform3D transformations. There is also a special transformation called Transform3DGroup that can be used to group and apply more than one transformation over the same element. In Listing 1 we use these transformations to place the models according to the layout logic.

Definition of the Panel3D
Listing 1 shows an approach to implementing a Panel3D. The default value for the property Transform of a Visual3D is MatrixTransform3D.Identity; that's why the method Move in Listing 1 asks for this value to know if the Transform property isn't explicitly set yet. The function of this Move method is to support moving elements according to the parameter offset using the transformations TranslateTransform3D and Transformation3DGroup.

The method OnVisualChildrenChanged calls the corresponding method of the base class ModelVisual3D and invokes the Arrange method when a new element is added to the panel. This Arrange method is abstract and must be implemented by the concrete descendants of Panel3D as we will see in the following case of a CubePanel.

Definition of a CubePanel
A CubePanel will be a sort of tri-dimensional grid that can be defined as a descendant of the type Panel3D overriding the Arrange method, as shown in Listing 2. A Grid in WPF allows elements to be added in a plane area, aligning them in rows and columns. The goal of a CubePanel is to add a third dimension so that if you want to put an element in some row and column, you can use YIndex instead of Row, XIndex instead of Column, with the ability to send the element back or bring it to the front with very realistic depth perspective using a ZIndex attached property. These indices refer to one of the coordinate descriptions declared in the collections XCoord and YCoord (equivalent to ColumnDescriptions and RowDescriptions of the Grid type) and the newest ZCoord. Accordingly, the SizeX, SizeY, and SizeZ properties define the dimensions of the whole CubePanel (see Listing 2).

A Pawn on the Chess Table
Listing 3 illustrates an application example of this CubePanel. The XAML code is used to place five planes, one sphere, and one cone as shown in Figure 5. The types SphereBuilder, PlaneBuilder, and ConeBuilder are essentially used to build the mesh of these figures. Their property Geometry returns a MeshGeometry3D bound to the Geometry property of the GeometryModel3D to get the result in Figure 5. We could discuss these types further but won't for want of space.

The WPF team is working hard to increment the primitives and basic capabilities of the API 3D. This article invites readers to dare to use the current capabilities of WPF to obtain 3D layout effects while waiting for the next generation of WPF 3D. Enjoy it!


  • Natham, A. (2007). Windows Presentation Foundation Unleashed. SAMS Publications.
  • Griffiths, I., and Sells, C. (2005). Programming Windows Presentation Foundation. O'Reilly.
  • Petzold, C. (2006). Applications = Code + Markup: A Guide to the Microsoft Windows Presentation Foundation. Microsoft Press.

More about panels in WPF can be found in the following Spanish publications of the authors:

  • Del Valle, M.; Sierra, I.; Hernández, Y.; and Katrib, M. "Cómo definir nuestros propios paneles personalizados en WPF." DotNetmanía No 35. Marzo 2007.
  • Katrib, M.; Del Valle, M.; Sierra, I.; and Hernández, Y. "Windows Presentation Foundation." DotNetManía Cuaderno Técnico No 7. Netalia 2007.
  • Del Valle, M.; Sierra, I.;Yamil Hernández, Y.; and Katrib, M. "Entrando en la tercera dimensión." DotNetmanía No 37. Mayo 2007.

More Stories By Miguel Katrib

Miguel Katrib is a PhD and a professor in the Computer Science Department at the University of Havana. He is also the head of the WEBOO group dedicated to Web and object-oriented technologies. Miguel is also a scientific advisor in .NET for the software enterprise CARE Technologies, Denia, Spain.

More Stories By Mario del Valle

Mario del Valle is working toward his MS at the Computer Science Department at the University of Havana, and is a software developer at the WEBOO group dedicated to Web and object-oriented technologies.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@ThingsExpo Stories
In his session at @ThingsExpo, Dr. Robert Cohen, an economist and senior fellow at the Economic Strategy Institute, presented the findings of a series of six detailed case studies of how large corporations are implementing IoT. The session explored how IoT has improved their economic performance, had major impacts on business models and resulted in impressive ROIs. The companies covered span manufacturing and services firms. He also explored servicification, how manufacturing firms shift from se...
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
SYS-CON Events announced today that Secure Channels, a cybersecurity firm, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Secure Channels, Inc. offers several products and solutions to its many clients, helping them protect critical data from being compromised and access to computer networks from the unauthorized. The company develops comprehensive data encryption security strategie...
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
The question before companies today is not whether to become intelligent, it’s a question of how and how fast. The key is to adopt and deploy an intelligent application strategy while simultaneously preparing to scale that intelligence. In her session at 21st Cloud Expo, Sangeeta Chakraborty, Chief Customer Officer at Ayasdi, will provide a tactical framework to become a truly intelligent enterprise, including how to identify the right applications for AI, how to build a Center of Excellence to ...
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
In his session at @ThingsExpo, Arvind Radhakrishnen discussed how IoT offers new business models in banking and financial services organizations with the capability to revolutionize products, payments, channels, business processes and asset management built on strong architectural foundation. The following topics were covered: How IoT stands to impact various business parameters including customer experience, cost and risk management within BFS organizations.
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
From 2013, NTT Communications has been providing cPaaS service, SkyWay. Its customer’s expectations for leveraging WebRTC technology are not only typical real-time communication use cases such as Web conference, remote education, but also IoT use cases such as remote camera monitoring, smart-glass, and robotic. Because of this, NTT Communications has numerous IoT business use-cases that its customers are developing on top of PaaS. WebRTC will lead IoT businesses to be more innovative and address...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a...