Magnify your diagram

Posted on February 18, 2010 by


Default layout mechanisms offered by DSL Tools are not challenged by VS’s 2010 edition. It’s not a reason to be disappointed but to acknowledge efforts produced into other areas such as extensibility. DSL Tools wisely called for help to offer alternative solutions that are far more than blinded workarounds. Indeed, the solution chosen is supporting WPF.

DSL Tools knew benefit from the announced marriage between this technology and Visual Studio.

This being said, to illustrate this choice, this post proposes to migrate the AirTraffic example published few months ago. This sample presented a mechanism to support WPF right from the 2008 version.

And the result is really encouraging, and allows thinking that WPF support isn’t reduced to form based design.

A screencast showing the end result is available below.

The recipe

Below are the steps to embed AirTraffic into VS:

  • Migrate your model by using the really cool dsl migration utility (I still wonder why this is not included right into VS conversion wizards)
  • Create a minimal WPF Designer dsl project
  • Leverage renewed copy and paste mechanism and simply copy the original project artifacts into the new WPF Designer DSL project
  • Copy and paste custom code and specific dsl parameters (Customize connection builder).

screenshot1  screenshot2

  • Transform all templates
  • Focus on UI project and especially ViewControl class
    • Extract code from AirReader wpf application, migrate only graph control.
  • Light a candle or give slaps when you are in front of minor bugs.
    • Reference required assemblies for ui project into dsl package, too.
    • Bind the collection view on a list wrapping the LinkedElementCollection of Airports. Indeed, unfortunately the LinkedElementCollection isn’t an ObservableCollection but implements the old school interface IBindingList. This unfortunately excludes most features exposed by CollectionViewSource such as Filter however collection binding from data templates works as expected.
  • Don’t run the project yet unless you want to define a model from the xml editor.
  • Keep the faith by developing a tool window to enrich the model displayed by your superb graph.
  • Add a WPF UserControl to the Dsl Package project
  • Inherit from ModelExplorerToolWindow class.
public partial class AirTrafficSearchToolWindow :
    public AirTrafficSearchToolWindow(
        IServiceProvider serviceProvider)
    : base(serviceProvider)

    protected override void OnDocumentWindowChanged(
        ModelingDocView oldView, ModelingDocView newView)
        base.OnDocumentWindowChanged(oldView, newView);
        var l_modelingDocData = this.DocData as ModelingDocData;
        if (l_modelingDocData == null)
        AirTrafficBrowser.DataContext =
  • Weep for joy in front of WPF support offered by Visual Studio
    • Update the xaml associated to your new control by replacing the root element with ModelExplorerToolWindow
  • Extract the code dedicated to the left panel of the AirReader application.
  • Invest a minimum on drag and drop mechanism and congratulate Bea Stollnitz work because the investment is really minimal thanks to her very detailed post.
    • You can safely stop bubbling event after custom handling.
  • Declare your user control as a standard tool window from Package class.
internal sealed partial class AirTrafficPackage
    protected override void Initialize()


Definitively, it would be a shame to reduce WPF use to form based design. And, the time of old school model explorer is running out.

The code will be available soon once updated to Visual Studio 2010 RC.


Download the complete solution here.

Creative Commons License
AirTraffic 2010 by MEXEDGE is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
Based on a work at

Tagged: , ,
Posted in: Modeling