MoXAML Power Toys

MoXAML Power Toys


MoXAML Power Toys is a Visual Studio AddIn that’s designed to make your coding that bit more productive for WPF/Silverlight applications.

I started writing MoXAML, partly because I wanted to address some of the features that I needed to be productive in WPF, but also as a complementary product to Karl Shifflett’s wonderful XAML Power Toys. Karl’s stated aim is to produce a tool that quickly and efficiently enables you to write LOB applications in WPF and Silverlight. My aim is to produce a tool that allows you to code with the minimum of effort in Visual Studio.

Update – 6th September 2011:

I’ve been rewriting MoXAML for VS 2010. The version I’ve just uploaded is the installer only version, and is intended to be installed for evaluation purposes as the internal registration mechanism has completely been rewritten. What does this mean exactly? Well, it means that you can install it and it will work properly as it stands (I’ve chosen to only include a small subset of the MoXAML commands to prove the application architecture).

OK, so we know the internal architecture has been rewritten, but what does this mean exactly? Well, a feature of the original MoXAML that I was unhappy with was the fact that I had to add commands and then add hard references to them in the VS integration part. This meant that I had to rerelease a new version of the code whenever I changed it, and that’s a complete PITA. Wouldn’t it be better, I thought, if I could come up with a mechanism for simplifying this and use a plugin based architecture instead? Well, thanks to those really nice people at Microsoft, I have the wonderful MEF to play with, so with a little bit of interface jiggery-pokery I can add new commands without any real hard code work, and more importantly if you want to add your own commands it’s easy for you to do – just add a reference to MoXAML.Infrastructure, add a class that derives from CommandBase and add some minimal configuration into your class constructor. All you need to do is add a unique CommandName, the Caption you want to appear on the relevant menu and the ParentCommandBar you want to Add the menu item to.

Update – 13th September 2011:

One of my favourite parts of MoXAML is the Scrubber command. While I liked it, it never felt finished to me, so now I’ve taken the time to address what I saw as the shortcomings in the original version. First of all, the options dialog isn’t shown when you run Scrubber; it’s in a separate menu of it’s own – Scrubber options. Secondly, I wasn’t happy that you could only scrub the project, sometimes I just want to scrub the file I’m currently in. Scrubber is now available for both the solution and the individual file. The cool thing – it’s available in it’s own DLL, so we are demonstrating the plugin nature of MoXAML.

Update – 15th September 2011:

MoXAML is now fully open source. Rather than maintaining it on the blog, I’ve created a dedicated codeplex page available at All source will be maintained there.


After downloading, you’ll need to change the extension from .doc to .zip. This is a requirement of

Visual Studio 2010 version

Installer – no source:

Visual Studio 2008 version

Installer – no source:  MoXAML Power Toys_Setup

Source code: MoXAML Power Toys Source

So, what can you do with MoXAML?

BabelCode – currently available only in VS 2008

With BabelCode you can instantly convert your VB code into C# and vice versa, how cool is that. Simply run BabelCode on your source code and it’s instantly converted.


BabelCode menu in operation.


Here’s the converted output from a BabelCode run.

Extract user control – currently available only in VS 2008

There have been times when I’ve been working on a piece of XAML and I’ve thought, “That would be really handy if it was a control – I could use it in so many places.” Well, with this feature, you can extract XAML and create a user control from it.


Here I’ve highlighted the items that I want to convert into a user control.


At this point, we enter the name of the control we want to create.


And here’s the control – added into our solution.

Scrubber  – available in both VS 2008 and 2010

Srubber is a port of Robby Ingebretsen’s scrubber feature in Kaxaml. If you haven’t tried Kaxaml out, then you are missing a treat.

Scrubber performs a “beautify” on your XAML items. It’s called from the Solution menu – just click on one of your source files, choose the Scrubber options and sit back as it works its magic on all of the XAML files in your solution.

Here’s a typical piece of XAML:

XAML before beautification

We choose Scrubber from the menu, and the scrubber dialog appears:



Here’s the same piece of code from above – after it’s been scrubbed:



Since originally posting Scrubber, a number of people have contacted me to tell me that there was a bug in the original Scrubber code where special characters in XML were being screwed up. Well, Scrubber has been updated to correct this bug – your special characters are now preserved.

Keyword search – currently available only in VS 2008

Highlight a word in the source and select Lookup keyword from the menu, and voila – a Google and Live search are performed based on the keyword (using the appropriate language type as well).

Menu in action

Commenting – available in both VS 2008 and 2010

Well, currently you can comment your XAML code and it works OK if you do it once, but if you then attempt to comment over the block again, you get some problems. The following picture shows what the problem actually is.

It doesn’t look too good does it? The first Power Toy, the Comment command behaves slightly differently:

As you can see, multiple comments and it continues to behave. So, that’s the Comment command – I hope you like it.

The sister command of the Comment command is the Uncomment command, and it works it’s way back up through the comment tree to uncomment the commands.

Notify properties – available in both VS 2008 and 2010

Automatic properties are great, but they don’t play nicely with two way data binding. Now it’s simple to convert an automatic property to use INotifyPropertyChanged. All you need to do is pick the property in the code window and select Notify Property (C# Only), and it will add the necessary plumbing.

Cunningly enough, it adds the Changed method if it’s not already present. ;->

Notify Property in action:

After the command:

The AppWizard – currently available only in VS 2008

This command allows you to add a status bar, toolbar and menu to your application.

Calling the AppWizard

The AppWizard brings up a dialog where you choose whether or not you want to see a toolbar, a menu or a statusbar. If you choose to add a toolbar or menu, you even get standard icons added into your project. The CommandBindings and App.Resources are set up for you, and the relevant user controls are added into your main window. The statusbar hooks up to the Caps Lock, Scroll Lock, Insert and Num Lock keys to reflect the state of them. It also adds in a date and time which updates every second. I love WPF.

The AppWizard in action

The AppWizard in action

Behind the scenes, some of the code injected into your application is C#, but being a nice chap I’ve added a converter in there which translates the C# to VB.NET before it gets added to your project if it detects that your project is VB.NET.

Dependency Properties – currently available only in VS 2008

One of the banes of my life, is typing in boilerplate code – and boy is there a lot of it with Dependency Properties. Well – that’s about to end. The Create Dependency Property command lets you create an ordinary DP or Attached DP (or readonly versions) with a minimum of effort. Better still, it provides method implementations for you as well – and it does this in both C# and VB.NET.

Selecting the menu (from inside the code editor window) brings up a dialog to enter the core information that you need to create the DP. When you enter the default value, you need to put it in “exactly” as you would if you entered it manually. This means that you must put quotes around it if that’s what is expected by the datatype.


The Create Dependency Property window

When you choose Create, the relevant code gets added into the class.

Add FieldModifier – available in VS 2008 and 2010

This command searches through your project for XAML files which have x:Name set without setting a FieldModifier. If it finds any entries like this, it adds the x:FieldModifier = “private” attribute. I’d like to thank Josh Smith for providing the inspiration for this command – please see this blog post for more information.

To use this command, right click in the Solution Explorer and choose MoXAML Power Toys > Add FieldModifier.

In conclusion

As always, keep your comments and requests coming in. No idea goes unconsidered.

  1. November 3, 2008 at 2:01 pm


    You are brining the heat!!

    Very nice sir!



  2. peteohanlon
    November 3, 2008 at 2:15 pm

    Thanks Karl – I’m proud of this one, especially as it removes so much room for boilerplate error.

  3. November 7, 2008 at 4:45 am

    Wow Pete! I’ve been outta touch for a while but this is great! The new DependencyProperty creator is exactly what I’ve been waiting for!

    One question–what does the Dependency Property (C# only) command do? I couldn’t figure it out and it doesn’t seem to do anything if I select it.

  4. peteohanlon
    November 7, 2008 at 9:18 am

    Logan – I talk about this one in this blog: It’s code that was created by somebody else for the addin, and one that I might end up beefing up because it currently only puts items on the clipboard – as I’m manipulating the classes anyway, I might use it to populate the class directly.

  5. Joeq
    February 4, 2009 at 3:26 am

    Download ain’t working for some reason.

    • peteohanlon
      February 6, 2009 at 8:40 pm

      Joeq – try now. WordPress was playing a bit funny with the settings.

  6. Joeq
    February 8, 2009 at 3:28 am

    Thanks, that worked.

    • peteohanlon
      February 8, 2009 at 10:03 pm

      Cool – I’m glad it worked.

  7. February 22, 2009 at 10:57 pm

    Really cool power tools … thanks !!!

    • peteohanlon
      February 23, 2009 at 8:44 am

      Thanks El Bruno. I’m glad you like it.

  8. Flo
    February 23, 2009 at 10:55 am

    Hey Pete! Thanks a lot for the scrubber! Great stuff!
    Only have one problem:
    If “&” (without quotes) appears in a text property, the “amp;” is removed.
    Is that intended?

    • peteohanlon
      February 23, 2009 at 10:59 am

      Nope – that’s a bug. I’ll have a look into this – thanks for the feedback.

  9. February 24, 2009 at 9:41 am

    Cool stuff Pete

    • peteohanlon
      February 24, 2009 at 9:46 am

      Thanks Sacha – I hope it helps.

  10. March 6, 2009 at 12:51 am

    I really like the scrubber! I’ve used it a lot in Kaxaml and I’m happy to be able to use it in VS. One issue with it is that it does not handle special character sequences very well, like 
. This add a line break in a string. I reported this to Kaxaml, but he was to busy writing the next version to address. With your port to VS, is this fixed or do the same issues occur?

    Thanks again

    • peteohanlon
      March 6, 2009 at 9:52 am

      The same issues exist – I ported the code pretty much “as is” and massaged it to work with Visual Studio projects. I’ve been made aware of this issue since I released MoXAML, and I will be looking to fix the code – I’ll pass the fix back to be put into KaXAML while I’m at it.

      I’m glad you like it though.

  11. Pete
    August 13, 2009 at 9:55 am

    Uh, it’s cool. Is there any way to get this working under VS2010?

    • peteohanlon
      August 13, 2009 at 10:18 am

      @Pete – I haven’t tried to get this running in VS2010 yet. It’s something I will be looking at sometime in the future, but I’ve got no plans to do it yet.

  12. August 14, 2009 at 10:05 am

    Wow Pete, nice work!

    • peteohanlon
      August 14, 2009 at 10:17 am

      Thanks Daniel – I’m glad you like it.

  13. Les Prigmore
    September 23, 2009 at 11:36 pm

    Using MS Vista SP2, VSTS2008 ENU SP 1 (KB945140)

    I installed MOXaml power Toys 2.5. Went to Tools->Options->Environment & added “C:\Program Files (x86)\Lifestyle Computing Ltd\MoXAML Power Toys” clicked OK; then went to Tools\Add-in Manager and checked MoXAMLPowerToys and clicked OK.

    I get the messaage:

    The Add-in ‘MoXAMLPowerToys’ failed to load or caused an exception.
    Would you like to remove………

    Error Message: The system could not find the file specified.
    Error number: 80070002

    However, there is a file named “C:\Program Files (x86)\Lifestyle Computing Ltd\MoXAML Power Toys\MoXAMLPowerToys.AddIn”

    I would like to get MoXAMLPowerToys working because it looks very useful. Any ideas about what might be going wrong?

    Les Prigmore

    • peteohanlon
      September 25, 2009 at 9:23 am

      Les – you shouldn’t have to add the addin manually – the installer takes care of this for you. I’d suggest that you remove the entry, uninstall the addin and then reinstall it. Hopefully this will sort this issue out for you.

  14. October 27, 2009 at 5:33 am


    Just checking in. You have done so much. Fantastic work!



    • peteohanlon
      October 27, 2009 at 2:07 pm

      Thanks Karl – I appreciate your continuing interest;->

  15. Keith D. Milby
    November 20, 2009 at 9:44 pm


    I had this working on my 32bit system. Great tools BTW.

    I have since got a new system XP 64bit. I have installed and uninstalled many times now but for whatever reason it is not showing in AddIn manager so therefore I can’t use it.

    Any suggestions?

    • peteohanlon
      November 27, 2009 at 11:16 pm

      Keith – thanks for trying out MoXAML. Could you take a look in My Documents\Visual Studio 2008\Addins? There should be a file called MoXAMLPowerToys.Addin present there. If it isn’t, please let me know and I’ll upload a one that you can use.

      • Keith D. Milby
        November 30, 2009 at 7:34 pm


        The file is there.

        FYI: My Documents is located on a Network Share if that is a problem.

        Thanks for the reply.

      • Keith D. Milby
        November 30, 2009 at 8:32 pm

        Fixed it, thanks for your time. Again, great product.

  16. Morris Cox
    November 27, 2009 at 10:12 pm

    I tried using the App Wizard in clean WPF app and WPF browser app projects and only the status bar works. This is in Visual Studio 2008 Professional. I also get the message that the root element is not supported in the visual designer. Where did I goof? And looking forward to support in VS2010.

    • peteohanlon
      November 27, 2009 at 11:10 pm


      If you take a look at the XAML in your main window, you’ll see that it’s added the controls to the grid as

      <moXAML:Menu Grid.Row="0" />
      <moXAML:Toolbar Grid.Row="1" />
      <moXAML:StatusBar Grid.Row="2" />

      Assuming you have this as a grid, you need to add some RowDefinitions, and then bind the relevant command to the row. Here’s a sample:

      <RowDefinition />
      <RowDefinition />
      <RowDefinition />
      <moXAML:Menu Grid.Row="0" />
      <moXAML:Toolbar Grid.Row="1" />
      <moXAML:StatusBar Grid.Row="2" />

  17. Morris Cox
    November 28, 2009 at 6:59 am

    Error 1 ‘moXAML’ is an undeclared namespace. Line 12, position 10. C:\Users\morris\Documents\Visual Studio 2008\Projects\SilverlightLearningApp\SilverlightLearningApp\MainPage.xaml 12 10 SilverlightLearningApp

    Error 1 ”moXAML’ is an undeclared namespace. Line 11, position 10.’ XML is not valid. C:\Users\morris\Documents\Visual Studio 2008\Projects\LearningWPFBrowserApp\LearningWPFBrowserApp\Page1.xaml 11 10 LearningWPFBrowserApp

  18. peteohanlon
    November 28, 2009 at 1:27 pm

    Morris – I’m surprised the namespace hasn’t been added in to the XAML – if it hasn’t though, you can manually add it to your window definition using xmlns:moXAML=”clr-namespace:NamespaceGoesHere”. I hope that helps.

  19. Morris Cox
    November 28, 2009 at 6:55 pm

    Thanks for the help. I finally got it to work on a WPF Application. I look forward to the next version. :) I do appreciate your help and this addon still saved me lots of time. I did add Name and Height values for each bar.

    • peteohanlon
      November 28, 2009 at 7:53 pm

      Thanks Morris. I’m glad it’s working, and I’m glad you like MoXAML. Just wait till I’ve released Goldlight – an MVVM framework that should really help speed up your developments. I’m in the final stages of putting the alpha version together.

  20. December 15, 2009 at 9:35 pm

    I’m using moxaml for the commenting feature and the scrubber. However, the scrubber doesn’t seem to work. I right-click on a file in the Solution explorer and run the scrubber. The dialog box appears, I hit ok, and nothing happens. The XAML is not nicely formatted, nor has it changed at all. I’m running VS2008

  21. James Todd Garza
    January 20, 2010 at 3:17 pm

    I’m in VS2008 SP1 and when I contextually use Scrubber by right clicking on a single XAML file in a project in the solution explorer window, Scrubber seems to be scrubbing every XAML file in the project (not just the one I selected). Is this the proper behavior?

  22. James Todd Garza
    January 20, 2010 at 3:43 pm

    One more concern. Scrubber normally moves any end tag down a line from the header content by inserting a CRLF. I’m seeing that this effect is cumulative. Each time I run scrubber on a file, another CRLF is added between the header content and the end tag. After running scrubber a few times, this can create quite a bit of whitespace.

    • James Todd Garza
      January 20, 2010 at 3:51 pm

      To be more specific:


      turns into


      • James Todd Garza
        January 20, 2010 at 3:54 pm

        Let’s try that again.

        It turns into:



  23. April 25, 2010 at 10:56 pm

    Your blog is so informative … ..I just bookmarked you….keep up the good work!!!!

  24. July 8, 2010 at 7:10 am

    Hi Pete,
    I have use your add-on in VS2008 and it is really great and help full for me,
    I just want to know if this add-on work in VS2010? As I like to install it in my working machine.

    Thanks again for this wonderful add-on.

    • peteohanlon
      July 8, 2010 at 7:22 pm

      Viral – I haven’t got round to updating it for VS2010 yet. I will be doing this at some time.

  25. September 28, 2010 at 4:53 pm

    I will be looking for this in VS2010, but it looks great, thanks for your contribution to the field of WPF / SL development. :-D

  26. Francisco Amador
    October 6, 2010 at 1:56 pm

    Thank you so much for this. I didn’t even think some of the things your extension does as things that could be simplified. Can’t wait until the VS2010 version is available.

    • peteohanlon
      October 6, 2010 at 2:18 pm

      Thanks Franciso – I promise that I’ll get the new version out soon. I’m currently working on a big article for Code Project, so my time is being taken up there, but once that’s sorted I’ll get back to MoXAML.

  27. Gabriel
    October 17, 2010 at 12:15 pm

    Unfortunately I can’t try your excellent tool, because it seems doesn’t work on VS2010. I copied the MoXAMLPowerToysAddin definnison files from the Documents/VS2008/Addins to VS2010 Addins, but without any effect. I’m waiting inpatiently for the update of this great tool.


  28. Jordan
    January 11, 2011 at 1:32 am

    Hi Pete,
    I’d love to help with the transition to VS2010. It would be the least I could do …I’m very thankful for your having taken the time to create this program as I feel the same way about dependency properties…the bane of my existence. Please let me know if there’s anything I can do to help, but I completely understand if this is something you want to do on your own.
    Best Regards,

    • peteohanlon
      January 11, 2011 at 8:21 am


      Thanks for your offer. It seems that it’s about time I made the transition with it to VS2010. I’ve been pondering the fate of MoXAML, and have decided that it would be better served being on a site such as codeplex, so I will probably be moving it to there.

  29. May 7, 2011 at 1:48 pm

    have use your add-on in VS2008 and it is really great and help full for me,
    I just want to know if this add-on work in VS2010? As I like to install it in my working machine.

  30. Stieven
    July 20, 2011 at 3:38 pm

    Any news for a working version for VS2010?
    Great tool, thx!

    • peteohanlon
      July 21, 2011 at 7:53 am

      Thanks for that. I am currently rewriting the BabelCode engine to take updates to the framework into account. At the same time, I’m rewriting the command infrastructure so that future updates can be dropped in and discovered without having to rerelease everything each time.

    • peteohanlon
      September 15, 2011 at 1:00 pm

      Just in case you weren’t aware, I’ve uploaded a new version of MoXAML that works with VS 2010. The installer is in the MoXAML page, and the source code is now available on CodePlex.

  31. jojo
    August 5, 2011 at 4:20 pm

    HI, I’m a biginner at and I’m working on a wPF project using the MvvM light toolkit , I don’t seem to make map my relational data base (sql) to objects , I don’t know how to make each table to a class (.cs file) like you already have here, i just wanna know how did you did it :)
    i tried to use but it didn’t work for me , it gave me one file where all my tables become partial classes in this file .
    so please can you tell me how and thanks :)

  32. September 27, 2011 at 11:43 pm

    excellent, thanks man

    • peteohanlon
      September 28, 2011 at 9:20 am

      You’re welcome. If you get a chance to download the code and play with it, you should go for it. Any suggestions for features, bugs, etc, please let me know.

  1. November 2, 2008 at 9:25 pm
  2. February 22, 2009 at 9:22 pm
  3. February 23, 2009 at 4:47 am
  4. February 24, 2009 at 6:10 am
  5. July 2, 2009 at 8:06 pm
  6. July 27, 2009 at 9:51 pm
  7. September 8, 2009 at 5:12 pm
  8. January 8, 2010 at 12:33 pm
  9. August 18, 2011 at 11:01 am
  10. September 6, 2011 at 8:53 pm
  11. September 13, 2011 at 9:20 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Train of Brain

All aboard.

The Canny Coder

Java 8 Functional Programming with Lambda Expressions

Adventures in theoretical computer science, with your host, chaiguy1337

Confessions of a coder

Confessions of a WPF lover is the best place for your personal blog or business site.


Get every new post delivered to your Inbox.

Join 39 other followers

%d bloggers like this: