Friday, July 21, 2006

Writing a Dock Panel System in .NET 3.0

So... I’ve just completed a dockable windows toolkit for our Aurora product. I thought I would share the details.

Initially, I thought it would take about 3 weeks. We had one developer take a stab at it, but it was so buggy and spaghetti-ish we did a rewrite.

The end result was pretty cool, and took about 1/3 of the code of the first attempt. We can dock panels inside panels that are floating or panels that are docked. We can add the panels such that they are children in a grid or merge the panels so that they are children in a tab control. We can dock on all four sides of our window and serialize out the last state and position of the individual panels. We have a control template written such that we can specify tabs on either top and bottom or left and right.

Overall, the .NET 3.0 API was perfect for this. It is so easy to take the content off of a tab control, for example, and apply it to a floating window. But ... it wasn’t without its difficulties. The Grid control was a complete pain. We tried a Dock Panel initially but it didn’t resize very well. The Grid resizes better, but when you collapse a panel in a cell in a Grid, the GridSplitter doesn’t handle fixed size objects very well. When we set a cell size to Auto, the Gridsplitter wouldn’t behave as desired for our requirements. This was a major hurdle that resulted in having to hook the GridSplitter delta change events and managing the size of the grid cells manually, often switching between grid cell length types that were ‘pixel’ and those that were ‘star’. The other problem we hit was getting the mouse position - it was often invalid or inaccurate if we were in the middle of a MouseCapture or Window.DragMove.

The end result is pretty neat. Check it out in the latest build of the Aurora XAML Designer on our Web site ...

Wednesday, July 05, 2006

Aurora Beta 9.3 for June CTP of .NET 3.0 Available

Our latest Beta of Aurora (9.3) is now available for the latest .NET 3.0 CTP (June). Click on the link to our company Web site on the right, which has links to both updates.

This is an engineering build with some new additions:
  • Simple Styles and Control Templates can now be visually created and modified - plus, there is support for triggers. This is new functionality and not fully cooked, but you can poke at it.
  • Opens Visual Studio 2005 project files, and allows for adding and editing of individual XAML documents
  • Cool magnifying glass inspector tool
  • 'Object Search' function for locating visual objects in your display

Be warned ... we had some issues upgrading to the .NET 3.0 June CTP. You might want to follow the following steps if you have a previous installation of .NET Framework 3.0 (a.k.a. WinFX Runtime Components 3.0) Beta 2. If you have WPF (Windows Presentation Foundation) functionality, you will need to manually update Windows Imaging Components (WIC) in order for WPF to function correctly.

1. Uninstall the current version or previous version of .NET Framework 3.0 (WinFX 3.0)
2. Uninstall previous WIC installation

1. Go to Start
2. Run...
3. Type in "%windir%\$NtUninstallWIC$\spuninst\spuninst.exe". Install .NET Framework 3.0 June CTP
4. Install WIC from: x86: http://go.microsoft.com/fwlink/?LinkID=69301&clcid=0x409x64: http://go.microsoft.com/fwlink/?LinkID=69302&clcid=0x409