Thursday, October 25, 2012

Take two [AvalonDock 2.0 Tutorials] and call...

CodeProject - AvalonDock [2.0] Tutorial Part 1 - Adding a Tool Window

"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)
    http://avalondock.codeplex.com/SourceControl/list/changesets
  • 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:

Lets get down to Business

Open the solution and set the Edi project as Startup Project in Visual Studio. Hit the F5 key to check that the application runs OK. I have seen the following content in my case:

...

image

..."

CodeProject - AvalonDock [2.0] Tutorial Part 2 - Adding a Start Page

"...

This part of the tutorial, explains how we can add a Start Page to an application that is build on AvalonDock [2.0]. 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.

This article is based on the solution that is described in the previous part 1. We are going to extend the solution in the V02_Edi_RecentFilesTW.zip file attached to the previous article. Therefore, it may be useful to download the V02_Edi_RecentFilesTW.zip file and the V03_Edi_RecentFilesTw_StartPage.zip attached to this article - since comparing both versions highlights all things that are necessary to implement the Start Page described here.

So lets have a look at the solution in the V03_Edi_RecentFilesTw_StartPage.zip container.

The ViewModel

The first thing to note is the Edi.ViewModel.StartPageViewModel and the Edi.View.StartPage classes which are both introduced to implement the viewmodel and view of the Start Page item. We also note a new base ViewModel class of the FileBaseViewModel type which is introduced to give the document viewmodels, FileViewModel and StartPageViewModel, a common root. This common root is necessary because the document collection is stored in the Workspace viewmodel:

...

image..."

Is it lame that after all this time I've still not used this awesome component in anything but a quick and dirty play-with app?  I'm green-fielding some WPF app's now, so maybe...  hum...

 

Related Past Post XRef:
THE open source WinForm & WPF docking library gets overhauled and a new version two, AvalonDock v2's!
AvalonEdit, a (the?) WPF code editor component from the SharpDevelop team (think WPF based, monster cool, code editing, IDE like, uber textbox +10)
Working Workflow into your app's. Workflow Studio, a source available example of rehosting the Workflow Designer

No comments: