In my previous blog post I introduced a new control that I have been working on called ContentControl3D. Back in May of 2008 I wrote a CodeProject article about a custom layout panel that arranges and animates 2D elements in 3D space, called Panel3D. Tonight I combined ContentControl3D and Panel3D to create an improved version of my WPF Disciples Blog Roll 3D application.
In order to make this application work, I had to enhance ContentControl3D by exposing more properties and methods in its public API. This version of the control is much better than the version posted previously. For example, you can now configure the camera used to view the 3D scene by setting the CameraPrototype property, and specify where the camera should move to during an animated rotation by setting the CameraZoomDestination property to a Point3D object. The following class diagram shows the API:
The 3D blog roll application now truly feels like a 3D experience. Not only is each blogger’s information hosted in 3D space, but each “tile” of information can rotate 180 degrees to reveal more details about a blogger. After navigating to a blogger in the list and clicking on his/her picture, that blogger’s tile rotates and looks like this:
Each ListBoxItem in the ListBox is assigned a custom ControlTemplate via the ItemContainerStyle property of ListBox. That template creates a ContentControl3D, which hosts two UserControls, one on each side of the 3D surface (i.e. the “tile”). The template declaration is listed below:
You can download the source code here: WPF Disciples Blog Roll 3D (Source Code). Note: Be sure to change the file extension from .DOC to .ZIP and then decompress it.