the blend addin class

I discovered, much to my surprise, that Blend 2 has the necessary infrastructure to support rudimentary custom extensions.  The extensions take the form of a class which implements the public interface Microsoft.Expression.Framework.AddIn.IAddIn.

Inline is a very simple HelloWorld sample.

AddInDescription("HelloWorld", AddInCategory.Tool)]
public class HelloWorld : IAddIn
{
    public void Initialize(IApplicationService 
      applicationService) {}

    public void StartupComplete()
    {
        // Show we were here
        System.Windows.MessageBox.Show("Hi");
    }

    public void ShuttingDown() {}

    IDisposable Members
}

AddIns are hooked on startup, specified as command line arguments:
path\to\blend.exe /addin:HelloWorld.dll

blend addin test

blend addin hello world

When initialized, an Application ServiceProvider object reference is passed, which contains accessors to all the major service provider objects of Blend.  Through this, it’s possible to add custom menus and dialogs, possibly even panels, to Blend.

I expect there are alot of limitations.  The most glaring is loading Addins only by specifying them as commandline arguments. Much of Blend is internal and/or sealed, including Nautilus (Blend’s code editor), Visual Studio abstractions for Projects, Solutions, and the Build system.  Enough remains open to allow for some customization of existing features, and certainly for new features.

menu and dialog inside blend

An annoying custom menu and dialog inside blend

More discovery needs to be done.

6 Responses to “the blend addin class”


  1. 1 Srikanth Mujjiga July 16, 2008 at 3:55 am

    Dear sir,
    I am using Silverlight 2 Beta 2. The Silverlight SDK does not have Microsoft.Expression.Framework.AddIn dll. Can you please help as I am currently working in trying to customize Expression Blend.

    Thanks in advance.

  2. 2 dragonshed July 16, 2008 at 10:22 am

    @ Srikanth

    The interface IAddIn is part of the assembly Microsoft.Expression.Framework.dll which is installed with blend. I’m using the Blend 2.5 June 2008 Preview, so on my system it is located in %PROGRAMFILES%\Microsoft Expression\Blend 2.5 June 2008 Preview\.

    Hope this helps

  3. 3 Rob Burke August 1, 2008 at 8:19 am

    Excellent find!! I was wondering if an add-in infrastructure existed for Blend.

  4. 4 Ben Hoffman August 8, 2008 at 3:12 pm

    I have been waiting for an extensibility infrastructure for Blend for quite some time – very glad you dropped this little nugget, did Microsoft publish this API?

  5. 5 dragonshed August 13, 2008 at 12:00 pm

    @Ben Hoffman, Microsoft hasn’t published any of the blend APIs as far as I’m aware. I’ve discovered the knowledge in this post, and a handful of other useful blend tidbits, by using Lutz Roeder’s .NET Reflector.

  6. 6 bitbonk October 22, 2008 at 4:48 am

    Did you know that belnd also supports some of the wpf designtime extensibility features of viusal studio (only roperty Editors, Metadata loading and Licensing) as described here:

    msdn.microsoft.com/en-us/library/bb546938.aspx

    and as discussed here:

    social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/899cbed8-3fac-49c5-b735-083e47c73327/


Leave a Reply




 

July 2008
S M T W T F S
    Aug »
 12345
6789101112
13141516171819
20212223242526
2728293031  

about

Karim Hernandez is a dev at IdentityMine, building software using WPF and Silverlight.

profiles