Pavan released his now popular ElementFlow control about a month ago. Dissecting his code was both a pleasure and very educational (It was written much nicer than my version). The coolest part was how he sub-classed a Panel and overlayed a Viewport3D on top. Being a sub-class of Panel, you have all the nice built in WPF functionality that goes along with it, such as using ItemsControl class and data-binding. One feature that I felt was missing from ElementFlow was having interactive 2D in 3D space.
Then Dr. WPF released some powerful code and article on the CodeProject site. Without delving too deep into his article, it is a way to have a Panel with children who can be connected or disconnected in your UI trees. Josh made a nice sample (Panel3D) to show off what you can do with it.
I figured Dr. WPF's LogicalPanel would be a great fit for upgrading Pavan's ElementFlow to support Viewport2DVisual3D classes because without it, you will find some big conflicts because the Visual needs to be a part of Viewport2DVisual3D's tree and the Panel's tree.
After a grueling couple hours, I got everything moved over to be interactive. It wasn't as easy as just renaming GeometryModel3Ds to ViewPort2DVisual3D. Quite a bit of code had to be tracked down and modified! After that was accomplished, the real fun began. Here's a list of changes I have made:
- Interactive2D on 3D
- Fixed issue where you could only data-bind once
- Removed visual reflection support in the control - Reflection is done in the control/data-templates
- Added support in ViewState sub-classes to select which animation-prototype to use. Might be bad form, but its decent for now.
- Modified animations to use keyframe animation with KeySplines. Animation looks *way* cooler that way ;)
- Camera and the light are set via XAML. You can now animate their properties.
- Added Spotlight to default example in showcase.
The new ElementFlow is called UIFlow3D. You can download it here: http://jmorrill.hjtcentral.com/Portals/21/blog/fluidkit.zip
Disclaimer: This code is not endorsed by Pavan. He has not even seen it as he is indisposed probably until next week.