Sunday, October 28, 2012

AvalonDock [2.0] Tutorial

Inline image 2

Introduction 

"AvalonDock is a WPF controls library which can be used to create a docking layout system like that is present in VisualStudio. It supports fly-out panes, floating windows, multiple docking manager in same window, styles and themes and it can host WinForms controls."  (citation from http://avalondock.codeplex.com/)

AvalonDock is a very complete and stable open source project for .Net/WPF that offers this functionality and has been in the making for half a decade now. The current solution is a step forward as it was build from scratch, supports MVVM, is themable, and can be localized.

AvalonDock was written by Adolfo Marinucci. I am in no way involved with the development of AvalonDock but felt that it was time to document some essential things. I am not sure whether I got everything completely right (since I am not the primary developer) but I am building on some experience and simply hope people will give me feedback here if I am making claims that are false. 

The first two parts of the tutorial are covering initial preperation steps and adding a Most Recent Files (MRU) tool window and a Start Page. There may be more parts on other AvalonDock subjects (theming, localization, AvalonEdit in AvalonDock 2.0) later. Those who cannot wait for later articles shall look at Edi (http://edi.codeplex.com) to see some of the things before I document them here. This article was in fact written with Edi.

Solution Preparation

Download AvalonDock sources from CodePlex (I used build 96566)
 
Find the version 2.0 Sub-folder and remove all other sub-folders
 
Review the solution in the version 2.0 sub-folder and remove all
test projects except for AvalonDock.MVVMTestApp

I ended up removing the sub-projects:

AvalonDock.TestApp.csproj
AvalonDock.WinFormsTestApp.csproj

and was left with:
AvalonDock (docking layout system library)
AvalonDock.Theme.VS2010 (theming resources library)
AvalonDock.Themes.Aero (theming resources library)

AvalonDock.MVVMTestApp (Test apllication to be extended in this article)
 
Add a new WPF Application project with the application name that you want to develop based on AvalonDock (mine is Edi) and copy files from AvalonDock.MVVMTestApp into the new project. I also resorted some items into folders and namespaces as you can see if you review V01_Edi.zip. Your solution should look something like this:

Read more: Codeproject
QR: Inline image 1

Posted via email from Jasper-Net