Updated 3/22/09: SnippetManager now copies the snippet to the clipboard when selected.

I’ve gotten a lot requests for the snippet manager I used at my Mix08 session.

So as promised, here it is for everyone who is interested: app, code.

The first incarnation of this application was done by Nick Kramer (Thanks Nick!).  I’ve tweaked it and added a WPF frontend.

How do I use it?

  • To use a snippet, drag the title of the snippet to the desired target app.
  • In order to move the app around, drag the black bottom portion of the window.
  • The topmost checkbox and load/close buttons work as you would expect.

If desired, you can start the app from the commandline:

snippetmanager.exe /notontop [snippetsfile] [snippetsfile] …

where /notontop indicates that the snippet manager should start out NOT being topmost.

What is the format of the snippet file?

The format of the snippet file is:

Line Meaning
/////////////////////////////// Separates the contents of one snippet from another snippet.
// First Snippet Title Indicates what the “title” for a snippet should be.

(Note: if a snippet does not have a title, the first line of the snippet appears in the snippet manager.)

————————– Separates sections of snippets and restarts numbering of snippets.
partial line:<content> Should treat <content> as part of an existing line.  (i.e. Snippet should not include a line break at its end.)
<other> Any other line is treated as the content of a snippet

Given the “exactness” of the file format, I’d recommend always copying and editing the sample snippet file.

The sample snippet file (which was used in the above screen shot) is included in the zip and shown below:

   1: ///////////////////////////////
   2: // First Snippet Title
   3:         <Style x:Key="TitleStyle" TargetType="TextBlock">
   4:             <Setter Property="FontSize" Value="35"/>
   5:         </Style>
   6: ///////////////////////////////
   7: // Second Snippet Title
   8: partial line:Style="{StaticResource TitleStyle}"
   9: ///////////////////////////////
  10: Snippet content (no title)
  11: ///////////////////////////////
  12: --------------------------
  13: ///////////////////////////////
  14: // Second Snippet Section
  15:         <ControlTemplate x:Key="SubmitButtonTemplate" TargetType="Button">
  16:             <Grid Width="70" Height="20"  Background="DarkGray">
  17:                 <TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="12" FontFamily="/fonts/IngebretsenNeato.ttf#Ingebretsen Neato" Text="Submit"/>
  18:             </Grid>
  19:         </ControlTemplate>


  1. Try:

    just forgot to put the ‘r’ at the end of snippetmanager

    Great little tool to keep snippets at my fingertips, thanks!

  2. This is great!
    I saw you use it at MIX and asked Adam Kinney & Mike Harsh about it. They told me you wrote it and were going to blog it so I’ve been paying attention 🙂


  3. Nice! I saw this in your MIX presentation and it looked pretty cool, but one thing came to mind as I watched you use it. Wouldn’t it be easier on you (the presenter) if the program just copied the snippet to the clipboard when you clicked on it in the list, then you pasted it wherever you want? This seems like it could be quicker, easier, and less error prone than drag and drop. If you’re worried about signaling choice/use of snippet to the audience, maybe you could highlight the selected snippet in the list.

  4. Perhaps I’m missing the point. There is already a snippet manager in Visual Studio. It’s been there since the first release of VS.NET. Just drag your code to the toolbox. How is your snippet editor better (other than having a WPF frontend)?

  5. I’ve been looking for something seperate to Visual Studio as sometimes you want to past snippets into other applications as part of a presentation.
    But no luck 🙁
    Worked with VS but not with SQL, IE, notepad etc.
    Will have a look at the code and see if there is a way to do this – maybe the suggestion of using the clipboard is the way to go?

  6. Visual Studio ships with a snippet editor. You can drag XML, code, XAML etc. to the ToolBox panel. You can create separate sections for snippets, for example, one for each presentation. Seems like you did a lot of work to create something that already exists.

  7. Hi Karen,

    Thanks for the snippets app. I asked for it during your great PDC session and it’s cool you have published it here.

    I really liked your session, well-prepared, good slides, clear demo’s, that’s the way I like to watch sessions, good job!

    So I see you like to travel. If you have plans to go to The Netherlands one day please drop me a mail so I can provide you of info of the best places to go to.

    bye Erik

Leave a Reply

Your email address will not be published. Required fields are marked *