Expression Blend, believe or not, has an add-in model. It’s highly unsupported but it exists. The unsupported nature of it means that you have to do a little Red Green style patching to get them to run in the first place and if they cause instability, don’t call Microsoft support. However, there are a couple of really cool ones that are out there.
There are three that I think that you have to have – Unify, Colorful Expression and BlendSense: XAML Intellisense for Expression Blend.
Getting a Blend Add-in to run
Because it’s not a supported add-in model, there’s not a built in add-in manager that does the heavy lifting like the Visual Studio Add-In manager.
What you have to do is open up Expression Blend (or Design) passing in your add-in as a command line option. This starts up blend with that add-in enabled. The good news is that you don’t have to do any type of COM registration or anything to get it to work. The bad news is that it’s a hassle for those of us who don’t live on the command line like some people.
Another other option, is to alter your Blend Shortcut to include the –addin parameter. This accomplishes the same task as the command line, it just does so without all the hassle of opening a command line.
There are multiple problems with both of these solutions.
First, it is only able to handle one add-in at a time. Second, that only loads the add-in when you specifically click on that shortcut but doesn’t work from a lot of other places, like launching from Visual Studio.
The great news about the first issue is that it can be solved by another add-in.
Unify Add-in
Unify is an add-in manager. It’s going to do all of the heavy lifting of loading and launch a number of different plug-ins such as the Xaml Intellisense for Blend and Colorful.
When Unify installs it automatically gives you a prompt that starts the Unify add-in. However, that still only solves the first problem of getting the add-in loaded when we deliberately set out to do so.
Launching Blend with Unity from Anywhere
The second problem, as mentioned above, is a little harrier. It’s that the shortcut is not the only way to run Blend. What you have to do is fix all of the different ways that you can run Blend. That includes selecting a project file from Windows Explorer and clicking Edit in Blend in Visual Studio.
This, unfortunately requires some registry hacks and the like but you can get there from here. The first registry hack to fix is the opening a solution from Windows Explorer. To accomplish this, the following code copied into a reg file works on a 64X machine. You’ll have to remove the (86) on a 32X machine.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Expression.Blend.ProjectFile\Shell\Open\Command]
@=”\”c:\\Program Files (x86)\\Microsoft Expression\\Blend 2\\Blend.exe\” \”%1\” /addin:Unify.dll”
The second registry hack to fix is the launching from Expression Blend by right-clicking on a XAML file in Visual Studio and selecting “Edit in Expression Blend”. To do this requires understanding how the right click in Visual Studio works. The list of available commands comes from the registry. When selected, it passes in two parameter. The first is the path to the actual solution and the second is a /file:filename.extension parameter. It looks as follows:
“C:\Program Files (x86)\Microsoft Expression\Blend 2\blend.exe” “C:\Projects\QuickNavigation\QuickNavigation.csproj” /file:”Page.xaml”
What we have to do is redirect this in the registry to a bat file that will pass in our /addin parameter. Personally, I created a BlendWithUnify.bat file in the /Blend directory as follows:
start “Blend” “C:\Program Files (x86)\Microsoft Expression\Blend 2\blend.exe” /addin:Unify.dll %1 %2
Technically, we could have used the .bat file with the first mechanism as well. We need to fix the registry key as follows:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Expression\Blend\VS]
“BlendLaunchPath”=”\”c:\\Program Files (x86)\\Microsoft Expression\\Blend 2\\BlendWithUnify.bat\””
Now we are cooking with gas and are ready to investigate a few more add-ins.
Colorful Expression Add-In
Colorful Expression was directed to me by Jared Bienz after the Expression Design tutorial that I talked about recently. It’s a sweet add-in to Expression Blend (or Design) that gives you access to a ton of different color swatches that are out there on the web. Specifically, it taps into Kulor on the Adobe site. These are mostly swatches put together by pro-designers. These are also rated so you can pick the higher rated groups to be sure. In any case, they are definitely better than the ones that my color-blind self can choose.
Jonas Follesø saw that Kulor has a open restful API and couldn’t resist playing with it. Combine that with the (unfortunately unsupported – see below on how to get it to actually run in Blend…) add-in model for Blend and magic happens.
What it does is that it shows up as a tab in Expression Blend (or Design) and alls you to browse color pallets from Kulor for use in your application. There are a couple of slick ways that you can do that.
First, if you are running Design, you can hit the down arrow looking thing under a swatch and save it as an Expression Design Color Swatch. The next two work in either Blend or Design.
First, you can click the # button or select the swatch and hit Ctrl-C to copy the swatch to the clip board. If you paste that on a Page or UserControl, you get the swatch, but more importantly, you get the colors created as static resource brushes. You can also just go into the XAML in either the UI surface or the app.xaml and paste them that way.
Second, you can use the color picker from the normal color picker to select an individual color. This is pretty cool as well as it allows you to be very selective about your colors.
You can also run it as a standalone application if you want to pick a color swatch for use in something other than Blend or Design. I can see using to figure out color pallets for my CSS style sheets. I’m also going to contact Jonas and see if he has thought about building it for Expression Web. But that’s just me wishing and hoping until I hear back from him.
Check out Colorful Expression and give it a whirl. I’m interested to see how you use it.
BlendSense: XAML Intellisense for Expression Blend Add-in
Just yesterday I was on a call with a guy who was frustrated by the fact that there’s no Intellisense in Blend for XAML. Well, ask and you shall receive. There’s a skunk works project called BlendSense that was put up at http://code.msdn.microsoft.com/BlendSense but it was only for the Beta versions of Expression Blend 2.5. They haven’t updated it for the release which was actually called Expression Blend 2 SP1. So, the good folks at http://www.rhizohm.net recompiled the code for us and posted it at BlendSense: XAML Intellisense for Expression Blend.
There are a couple of limitations on it’s functionality. right now, it’s using the WPF namespace types and the like for it’s Intellisense. That means that it’s not ideal for Silverlight as the Intellisense might be lie to you – but that would just take me back to my MFC days… The second limitation is that it doesn’t handle custom namespaces and the like so you’re out of luck if you are using a custom control or third party components.
Technically, it’s using an XSD file that is built for Intellisense so you could edit it to fit your needs.
Conclusion
These three add-ins are fantastic and I’m thrilled that they are here. Both of them have already, in the day that I’ve been using them, saved me time and energy in some things that I’m working on. It’s a little bit of a frustrating process to get Unify running for every scenario but it’s worth it and hopefully I’ve done the leg work on figuring it out for for you.